We solved it by using calculated property for the desired unique index: s {calcPropForIndex}=$s({originalProp}='':someUnusedValue,1:{originalProp})
The suggestion of Robert to use ''(empty string) instead of NULL can cause problem using object script, obj.porp="" is equivalent to set NULL in SQL. Also FYI, there is a parameter INDEXNULLMARKER in %Library.DataType class, but it is crazy to override every type to have it in unique Index.
In my opinion using of NULL in Cache is really confusing.
We solved it by using calculated property for the desired unique index:
s {calcPropForIndex}=$s({originalProp}='':someUnusedValue,1:{originalProp})
The suggestion of Robert to use ''(empty string) instead of NULL can cause problem using object script, obj.porp="" is equivalent to set NULL in SQL.
Also FYI, there is a parameter INDEXNULLMARKER in %Library.DataType class, but it is crazy to override every type to have it in unique Index.
In my opinion using of NULL in Cache is really confusing.