DisplayAttributes: IMsDisplayAttributeSettingsList;
The DisplayAttributes property returns collection of attribute display settings in string view of expression elements.
String view of expression elements is used, for example, on displaying factor and expression names for determinate equation calculation.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a determinate equation model with the MODEL_DISPLAY identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MSKey: Integer;
Model: IMsModel;
Transform: IMsFormulaTransform;
Sett: IMsDisplaySettings;
AttributeSett: IMsDisplayAttributeSettingsList;
OutVar: IMsFormulaTransformVariable;
SelSet: IDimSelectionSet;
Dim: IDimensionModel;
Attr: IMsDisplayAttributeSettings;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MSKey := mb.GetObjectKeyById("MS");
// Get the model
Model := mb.ItemByIdNamespace("MODEL_DISPLAY", MSKey).Edit As IMsModel;
// Get model parameters
Transform := Model.Transform;
// Get model display parameters
Sett := Transform.DisplaySettings;
// Set parent element display mode for expression element
Sett.DisplayParentAs := MsDisplayParent.Id;
// Get collection of settings of attributes displayed in string view of expression element
AttributeSett := Sett.DisplayAttributes;
// Clear collection
AttributeSett.Clear;
// Get output variable
OutVar := Transform.Outputs.Item(0);
// Get selection of output variable dimensions
SelSet := OutVar.Slices.Item(0).Selection;
// Get the first dimension of output variable
Dim := SelSet.Item(0).Dimension.Dimension;
// Add a setting based on obtained dimension
Attr := AttributeSett.Add(Dim);
// Specify that expression element displays value of the KEY attribute
Attr.AttributeId := "KEY";
// Output dimension name to console window
Debug.WriteLine((Attr.Dimension As IMetabaseObject).Name);
// Save changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example parent element identifier and first dimension key are displayed for expression factors and elements in the model equation.
See also: