Analyzing value types

1C:Enterprise uses values of Type type for analyzing value types. You can get a Type value from a string (type name) using the Type() function, or you can get a Type value from a value whose type you want to know using the TypeOf() function.

Use Type values for analyzing types. Example:

TypeOf(CurrentDate) = Type("Date");

Note that string presentations of types (Type values converted to strings) are intended for display to end-users. For example, string presentations are displayed when a user selects a type in an input field. String presentations depend on the application interface language. Therefore, they cannot be used for analyzing types.

If you need to know the metadata object used as a basis for the creation of a specific applied object, use the FindByType() method of ConfigurationMetadataObject.

For example, the following script fragment checks whether a value type is one of the catalogs.

Type = TypeOf(Constants.MainWarehouse.Get());
Md = Metadata.FindByType(Type);
Message(Metadata.Catalogs.Index(Md) > 0);

You can use the AllRefsType() method of applied object managers to analyze applied object references. The method returns a TypeDescription object that contains object reference types. For example, the following script fragment checks whether a constant value is a catalog reference.

Type = TypeOf(Constants.MainWarehouse.Get());
Message(Catalogs.AllRefsType().ContainsType(Type));
Next page: Serialization usage specifics

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.