Question
· Aug 4, 2023

How to create a global node, without knowing the number of keys in advance ?

Hello,
I would like to do the following :

set name = $name(^A)
for i=1:1:10
{
    set $qsubscript(name, i) = "TEST"_i //dream code that does not work
}
set @name = "" //will create ^A("TEST1", "TEST2", "TEST3", ... , "TEST10") = ""

Unfortunately, unlike $PIECE(), $QSUBSCRIPT() is not bidirectional.

Is there a way to do what I described, in a clean way ? (something supported by the system) 

I would like to avoid :

- using a custom made solution (eg: appending keys one by one to a string, adding commas when needed) unless it's failproof (eg: can deal with commas in keys, non string keys, ...)
- having code that do multiple writes to database (eg: code that create ^A("TEST1") then ^A("TEST1", "TEST2"), ... sequentially. That's inefficient and not what I want.

Product version: IRIS 2021.1
$ZV: IRIS for Windows (x86-64) 2021.1 (Build 215U) Wed Jun 9 2021 09:39:22 EDT
Discussion (6)2
Log in or sign up to continue