SetStub(Value: IVariableStub);
Value. Data source.
The SetStub method sets a new data source for the variable.
Executing the example requires a form, a button with the Button1 identifier on this form, the TabSheetBox component and the UiErAnalyzer component named UiErAnalyzer1 that is used as a data source for TabSheetBox. Workbook of the time series database must be loaded to UiErAnalyzer1.
Click the button to start executing of this example.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
ErAn: IEaxAnalyzer;
Laner: ILaner;
Series: ILanerSeries;
CalcSerie, Serie: ILanerCalculateSerie;
tr: IMsFormulaTransform;
OutVar, InpVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Determ: IMsDeterministicTransform;
TermInfo: IMsFormulaTermInfo;
Begin
ErAn := UiErAnalyzer1.ErAnalyzer;
Laner := ErAn.Laner;
Laner.BeginUpdate;
Series := Laner.Series;
Serie := Series.Item(0) As ILanerCalculateSerie;
Serie.UseTransform := True;
tr := Serie.Transform.Transform As IMsFormulaTransform;
Serie.Name := " + 10";
OutVar := tr.Outputs.Item(0);
Slice := OutVar.Slices.Add(Null);
Selector := tr.CreateSelector;
Selector.Slice := Slice;
Formula := tr.Transform(Selector);
Formula.Kind := MsFormulaKind.Deterministic;
Determ := Formula.Method As IMsDeterministicTransform;
InpVar := tr.Inputs.Add(Serie.SourceStub);
CalcSerie := Series.Item(1) As ILanerCalculateSerie;
InpVar.SetStub(CalcSerie.SourceStub);
Slice := InpVar.Slices.Add(Null);
TermInfo := tr.CreateTermInfo;
TermInfo.Slice := Slice;
Determ.Expression.AsString := TermInfo.TermInnerText + " + 10";
Laner.EndUpdate;
End Sub Button1OnClick;
After executing the example values of the first series of the workbook are calculated under the formula: values of input series increased by ten. The source data for input series is the second number of the workbook.
See also: