%OpenId Query

Question: One persistent class ID column is a combination of its properties (Roll No and Marks) [ Exact: RollNo||Marks]. When i am running the query from Management portal it is displaying data in the same format and data is there. But in the code if i am making below statement, i am getting null value.

Set ExistsID=##Class(User.School).%ExistsId(RollNo_"||"_Marks)

set ID=##Class(User.School).%OpenId(RollNo_"||"_Marks)

ExistsID showing 1, but ID is always displaying as Null but data is there in class with that ID. Why?? If ID is passed as string will OpenId didn't work??

I am running with roll no:2 and Marks:11 [2||11}. In management portal it is displaying the same but in when i am trying to openid ID is coming as Null every time. Why ??

Here we have some two properties, to store both values separately, but we used both of their values as IdKey.

Now it is possible to check of existing an object by ##class(User.School).%ExistsId(RollNo_"||"_Marks), or open id by ##class(User.School).%OpenId(RollNo_"||"_Marks)

But in additional to this system methods, we now have some new ones which construct with index name and "Exists", "Open" and so on. But call will be a bit different. You should pass all values separately in this way.

##class(User.School).RollNoMarksExists(RollNo, Marks)

##class(User.School).RollNoMarksOpen(RollNo, Marks, , .sc)

You can try any of these ways, and you should remember about Status variable, which may help you to understand what's happening.