Question
· Jul 21, 2023

How to have a different conditional check for a null object and locked object?

I have a list type data object, that has both null entries and locked entries. While iterating through the list items using GetAt() function, a locked item is satisfying the not null condition. But I need a different conditional statement for null items and locked items.

Discussion (3)1
Log in or sign up to continue

Do you have a code snippet for us? Something like

write mylist.%IsA("%ListOfDataTypes") --> 1
set item = mylist.%GetAt(2)
//
// Now the big question: what do you (want to) do with this item?
//
// do you try to lock a global: lock ^myGlobal(item) ?
// do you try to open (a possible locked) Object: set obj=##class(some.class).%OpenId(item [,4]) ?
// something else?