Quintiq file version 2.0
#parent: #root
StaticMethod CreateExcelFromSnapshot (KpiSnapshotSetData snapshotSetData, KpiTracker kpitracker) as BinaryValue
{
Description: 'Creates a Excel string out of the specified KpiSnapshotDatas'
TextBody:
[*
// Render header line.
lines := construct( Strings );
conversion := ConversionOptions::System();
lines.Add( '' );
lines.Add( '
' );
lines.Add( 'KpiValue' );
lines.Add( '' );
lines.Add( 'PlanDateTime' );
lines.Add( 'String' );
traverse( snapshotSetData, SnapshotData, snapshot )
{
lines.Add( ' | ' );
}
lines.Add( '' );
lines.Add( '' );
lines.Add( 'ServerDateTime' );
lines.Add( 'String' );
traverse( snapshotSetData, SnapshotData, snapshot )
{
lines.Add( ' | ' );
}
lines.Add( '' );
lines.Add( '' );
lines.Add( 'RetentionPolicyID' );
lines.Add( 'String' );
traverse( snapshotSetData, SnapshotData, snapshot )
{
lines.Add( ' | ' );
}
lines.Add( '' );
// -- Label
sortedLabels := selectsortedset( kpitracker, Label, label, true, label.Name() );
traverse( sortedLabels, Elements, label )
{
lines.Add( '' );
lines.Add( '' + "label_" + label.Name() + '' );
lines.Add( 'String' );
traverse( snapshotSetData, SnapshotData, snapshot )
{
labelValue := select( snapshot, Label, labelV, label.Name() = labelV.Name() );
lines.Add( ' | ' );
}
lines.Add( '' );
}
// -- Value
sortedKpis := selectsortedset( kpitracker, MetaData, kpi, true, kpi.Name() );
traverse( sortedKpis, Elements, kpi )
{
lines.Add( '' );
lines.Add( '' + "kpi_" + kpi.Name() + '' );
lines.Add( 'String' );
traverse( snapshotSetData, SnapshotData, snapshot )
{
kpiValue := select( snapshot, Value, value, kpi.Name() = value.Name() );
lines.Add( ' | ' );
}
lines.Add( '' );
}
// Send result.
lines.Add( '
' );
binary := BinaryValue::Construct( lines.Concatenate( String::NewLine() ) );
return binary;
*]
InterfaceProperties { Accessibility: 'Module' }
}