David Satorres · Oct 12, 2020

Creating index combining List(ELEMENTS) and another standard Property


I'm trying (and not succeeding) to build an index based on a collection property combined with a property, like:

Index Test On (Property, ListProperty(ELEMENTS).Property2)


For example, I have a class with this properties:
Property Simple As %String;
Property ListOfProp As List Of AnotherObject;

The, I try to create a simple index of one of the AnotherObject properties and I can compile and it creates the right index:
Index Test On (ListOfProp(ELEMENTS).Name);

But when I add a "normal" property, compiler miserably fails:
Index Test On (Simple, ListOfProp(ELEMENTS).Name);

Compiling routine 
ERROR: TestingClass.cls(%SaveData+50) #1079: Invalid JSON string syntax : '^TestingClassI("Test",$zu(28,zzc33v2,7,32768),$zu(28,{UNRESOLVED:ListOfProp(ELEMENTS).%%OREF*O}.Name,7,32768),id)' : Offset:73 [%SaveData+49^TestingClass.1]
 TEXT: kill ^TestingClassI("Test",$zu(28,zzc33v2,7,32768),$zu(28,{UNRESOLVED:ListOfProp(ELEMENTS).%%OREF*O}.Name,7,32768),id)
Detected 1 errors during compilation in 0.156s.

Is there any special option I need to add there? Somebody has struggled with it before?

0 4 61 2


I think you'll need 2 separate indices for that.

This looks like it is just a bug.  I reproduced this in InterSystems IRIS latest.  Looking at the generated code we are able to resolve the the index global in other places, but not in this one case.

I will report the bug to development to get it fixed.

My question is what do you plan to use this index for?

Hi Brendan,

I wanted to use it to have an index not based on the Keys. Finally, I've solved it by storing the values as Array Of %String, and into the string I got the values separated by # so I can access them via $p. And using as a array key what I needed to be indexed.

It works quite well :-)

Thanks anyway for reporting it :-)