TermElementID(Term: String): String;
Term - term.
The TermElementID property determines identifier of the dimension element for the expression term. This property is considered if the value of the TermType property is equal to Element.
Executing the example requires a form, a button on this form and named Button1, the UiReport component with the UiReport1 identifier used as a data source for the ReportBox component. The repository should contain the OBJ_REPORT regular report containing a data area.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
ReportObj: IMetabaseObject;
Report: IPrxReport;
DIs: IPrxDataIslands;
DI: IPrxDataIsland;
Prop: IPrxDataIslandProperties;
Dim: IDimInstance;
DimProp: IPrxDataIslandDimension;
Layout: IPrxDataIslandDimensionLayout;
RN: IPrxDataIslandDimensionLayoutNodes;
Element: IPrxDataIslandDimensionLayoutNode;
FormulaParser: IPrxDataIslandDimensionLayoutFormulaParser;
Term: String;
Begin
MB := MetabaseClass.Active;
ReportObj := MB.ItemById("OBJ_REPORT").Edit;
Report := ReportObj As IPrxReport;
DIs := Report.DataIslands;
DI := DIs.Item(0).Edit;
Prop := DI.Properties;
Dim := DI.Slice.LeftHeader.Item(0).Dimension;
DimProp := Prop.Dimension(Dim.Dimension);
DimProp.CustomLayout := True;
Layout := DimProp.Layout;
Layout.FitToSelection := False;
RN := Layout.RootNodes;
RN.Clear;
Element := RN.Add;
Element.DimElement(Dim) := 1;
Element.Caption := "Element";
Element := RN.Add;
Element.Caption := "Doubled element";
Element.DimElement(Dim) := 1;
FormulaParser := Layout.CreateFormulaParser;
FormulaParser.ClearTerms;
FormulaParser.Node := Element;
Term := FormulaParser.AddTerm;
FormulaParser.TermType(Term) := LayoutFormulaTermType.Element;
FormulaParser.TermElementID(Term) := Dim.Elements.Id(1);
FormulaParser.TermText(Term) := Dim.Elements.Name(1);
FormulaParser.Parse(Term + " * 2");
DI.Save;
Report.Recalc;
ReportObj.Save;
UiReport1.Active := False;
UiReport1.Instance := ReportObj;
End Sub Button1OnClick;
After executing the example two heading elements are created in the first data area of the regular report. The following formula is set for values of the second element: doubled value of the element.
See also: