Quintiq file version 2.0
#parent: #root
Method GetConfigurationQuery () as JSON id:Method_Kpi_frmKpiMatrix_GetConfigurationQuery
{
  #keys: '[146874.0.1463045835]'
  Body:
  [*
    // Converts the configuration query into JSON.
    json := JSON::Object();
    
    queryType := KpiQuery::QUERY_COMPARE();
    
    json.Add( "QueryType", queryType );
    
    series := guard( selKpiCompareLabel.Data().Name(), '' );
    timetype := rbgTimeType.BoundValue();
    
    json.Add( "Series", series );
    json.Add( "Timetype", timetype );
    
    // Label filtering
    comparelabels := selectvalues( dhSelectedCompareLabelValues.Data(), Elements, labelvalue, true, labelvalue.Value() );
    labelfilters  := selectvalues( dhSelectedFilterLabelValues.Data(), Elements, labelvalue, true, labelvalue.Value() );
    
    labelvalues := comparelabels.Merge( labelfilters );
    
    json.Add( "LabelFilters", labelvalues.ToString( "," ) );
    
    // Kpi selection
    metadatas := selectvalues( dhSelectedKpis.Data(), Elements, metadata, true, metadata.DisplayName() );
    json.Add( "MetaDatas", metadatas.ToString( "," ) );
    
    return &json.Build();
  *]
  ReturnsOwning: true
}
