Quintiq file version 2.0
#parent: #root
Method AddColumn (
  internal[ColumnTitles] columns,
  structured[shadow[LibOpt_BT_UIKPIColumn]] attributes,
  internal[DataSetColumn] target
) id:Method_FormBTS_AddColumn
{
  #keys: '[139544.0.993014825]'
  Body:
  [*
    level := columns.DataSetLevel();
    
    traverse( attributes, Elements, kpi )
    {
      column := DataSetConfigurableColumn::Create( level.Columns() );
      column.Text( this.CreateConfigurableColumnString( kpi ) );
      column.Name( kpi.KPIDefinition().Name() );
    
      if( isnull( target ) )
      {
        level.Columns().StoreColumn( &column );
      }
      else
      {
        target := level.Columns().StoreColumnBefore( &column, target );
      }
      
      kpi.Selected( true );
    }
  *]
}
