ErrorText: String;
The ErrorText method checks settings and returns error message.
Errors may occur on managing calculation period in the following cases:
If the used calculation algorithm parameter is not found.
If the used dictionary attribute linked to the parameter is not found.
Possible error messages: The <name> parameter is not found that controls the <date> of calculation, The <name> attribute is not found in the <name> (<identifier>) dictionary of the <name> (<identifier>) parameter, which controls the <date> of calculation.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. Calculation period control is set up in the calculation algorithm.
Add links to the Algo and Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
CalcAlgo: ICalcAlgorithm;
Settings: IAlgorithmSettings;
DataStart, DataEnd: IAlgorithmPeriodControl;
s: String;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get algorithm calculation period settings
Settings := CalcAlgo.Settings;
DataStart := Settings.PeriodControlStart;
DataEnd := Settings.PeriodControlEnd;
// Check if configured calculation end date is used
If DataStart.IsEnabled Then
s := DataStart.ErrorText;
If s <> "" Then
Debug.WriteLine("Error: " + s);
End If;
End If;
If DataEnd.IsEnabled Then
s := DataEnd.ErrorText;
If s <> "" Then
Debug.WriteLine("Error: " + s);
End If;
End If;
End Sub UserProc;
After executing the example, control settings for calculation start date and end date are checked. If there are some errors, their text is displayed in the development environment console.
See also: