Getting the predefined catalog item name

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company: TLG Integration

Hello!
I need to obtain a name of a predefined catalog item as it is named in the list of predefined items in Designer. I was trying to use

Code
MyItem.Metadata().Name

But this returns name of catalog, not the catalog item name.
Any ideas?

 
#2
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

CatalogManager.<Catalog name>.GetPredefinedItemName
CatalogManager.<Catalog name>
GetPredefinedItemName
Syntax:

GetPredefinedItemName(<Reference>)
Parameters:

<Reference> (required)

Type: CatalogRef.
Reference to the item, the name of which is to be obtained.
Returned value:

Type: String.

Description:

Obtains the name of a predefined item. If this item is not predefined an empty string is returned.

Availability:

Server, thick client, external connection.

 
#3
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company: TLG Integration

Oh, thank you!
By the way if there is something like that for enumerations?

 
#4
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

There is another way for enumerations

Code
EnumIndex = Enums.Enum1.IndexOf(Object.Attribute1);
EnumName = Object.Attribute1.Metadata().EnumValues[EnumIndex].Name;

 
#5
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company: TLG Integration

Thanks for your reply, alexht! That's very helpful.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
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.