Easier Way to Get Catalog Item by Code

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Sep 16, 2011
Company: Oksley Shipping

Hello!
AFAIK, to get data not by a link in an object or form attribute I need to create and execute a query. Is there a shorter way if I have a unique standard attribute Code in my catalog?

 
#2
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Nov 24, 2011
Company:

Code
CodeString = "840";
Currencies = Cataloges.Currencies;
SearchRef = Currencies.FindByCode(CodeString);
If SearchRef = Currencies.EmptyRef() Then
    DoMessageBox("There is no currencies by code " + CodeString);
EndIf;

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Dec 6, 2011
Company:

Use FindByCode method of CatalogManager

 
#4
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Nov 24, 2011
Company:

but...Queries is best(and more nice) way for this, cause FindByCode isn't accesible in all version of clients, but at server you can use it always:)

 
#5
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Nov 24, 2011
Company:

.. FindByAttribute, FindByDescription..

 
#6
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Sep 16, 2011
Company: Oksley Shipping

Oh, thank you, guys! You're great!

 
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.