Quintiq file version 2.0
#parent: Button
Response OnClick () id:Response_FormAlgorithmRuns_Button_OnClick
{
  #keys: '[110880.3.1380316150]'
  Body:
  [*
    // Generate configurable columns for account KPIs for exporting
    
    columns := ColumnTitlesLevels.DataSetLevel().Columns();
    column := null( DataSetConfigurableColumn );
    
    traverse( MacroPlan.GetOptimizerAccounts(), Elements, account )
    {
      columnname := account.Name();
    
      c := select( columns, Columns.astype( DataSetConfigurableColumn ), c,
                   c.Name() = columnname );
    
      if( not isnull( c ) )
      {
        column := c;
      }
      else
      {
        c2 := DataSetConfigurableColumn::Create( columns );
        c2.Name( columnname );
        column := columns.StoreColumn( &c2 ).astype( DataSetConfigurableColumn );
      }
      // Set Quill code for configurable column
      if( not isnull( column ) )
      {
        column.SetText( "VALUE( select( object, OptimizerAccountKPIResult, result, result.AccountName() = '" + columnname + "' ).TotalGoalValue() )" );
      }
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
  Precondition:
  [*
    return MacroPlan::HasMacroPlan( MacroPlan, feedback );
  *]
  UserRequiresReadWrite: true
}
