What is a Correct Method to find out if there is a Key in the Structure?

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

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

Please answer how to find out if there is a key in the structure? I’m trying the following code:

Code
Try
    Value = MyStructure.StructureKey;
Except
    Value = Undefined;
EndTry;

But it always breaks on an error at that place if I use Stop on Errors in Debugger. Is there a correct way of doing this?

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

Use the following:

Code
If MyStructure.Property("StructureKey") Then
    // Your code here
EndIf;

 
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.