Quintiq file version 2.0 #parent: #root Method RefreshUIIsLastAttribute ( shadow[KpiSnapshotSetData] queryResult, KpiLabel series, Boolean isLastSnapshotChecked, structured[KpiMetaData] metadatas ) id:Method_Kpi_GlobalState_RefreshUIIsLastAttribute { #keys: '[146874.0.1589144606]' Body: [* // Updates the UI_IsLast attribute of the KpiValues to match the selected series / kpi. // Call this method after updating the 'UI_LabelValue' attribute. // First clean previously set flags. traverse( selectset( queryResult, SnapshotData.Value, v, v.UI_IsLast() ), Elements, val ) { val.UI_IsLast( false ); } // Now, if the checkbox is checked and a Series has been selected, // determine which KpiValue objects represent the LAST snapshot of their // KPI & LabelValue of the selected Series (= Label) if ( isLastSnapshotChecked and not isnull( series ) ) { traverse( series, Value, serieValue ) { traverse( metadatas, Elements, kpi ) { lastValue := maxselect( queryResult, SnapshotData.Value, v, v.UI_LabelValue() = serieValue.Value() and v.Name() = kpi.Name(), v.UI_DateTime() ); if ( not isnull( lastValue ) ) { lastValue.UI_IsLast( true ) } } } } *] }