IsObjectsIdFormatValid(ObjectIdFormat: String): Boolean;
ObjectIdFormat. String to check that data is correct.
The IsObjectsIdFormatValid method checks the string for incorrect data (Cyrillic characters, the first character is number, and so on).
The method returns True if the string is correct and False if the string has incorrect data. If it is correct, the string can be used as identifier format. Incorrect format is not sent to a core and is not used to form object identifiers.
To set format of repository object identifiers, use the IMetabasePolicy.ObjectsIdFormat property.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
Policy: IMetabasePolicy;
Str: String;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
Policy := MS.Policy;
// Set string for check
Str := "ID_*";
// Display check result in the console
If Policy.IsObjectsIdFormatValid(Str) Then
Debug.WriteLine("String is correct");
// If string is correct, set it as object identifier format
Policy.ObjectsIdFormat := Str;
// Save changes
MS.Apply;
Else
Debug.WriteLine("String contains incorrect data");
End If;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example the console displays check result of the specified string. If string is correct, it will be set as object identifier format.
See also: