Is it possible to have a MUMPS variable representing all subscripts for a global?
Is it possible to have a single MUMPS variable representing all subscripts for a global? For example, if I have an ^ABC global and the ^ABC(1,2) node exist, is it possible to have a variable TEMP so that ^ABC(TEMP) would represent ^ABC(1,2)? TEMP="1,2" obviously does not work since it is interpreted as a single subscript, not two subscripts.
Product version: Caché 2017.1
Discussion (4)2
Comments
Sure, use indirection:
>s ^ABC(1,2)=3
>s TEMP = "^ABC(1,2)"
>w @TEMP
3I was so focused on subscripts that I forgot about indirection :-) . Thanks!
You can do $Name for the global and use your subscript runtime
set gbl= $NA(^ABC)
write @gbl@(1,2)
set sub=1
write @gbl@(sub)
Yet another example:
USER>s ^abc(1,2)=3
USER>s temp="1,2"
USER>w @("^abc("_temp_")")
3
;; Three subscripts referencing an undefined ^abc entry
USER>set temp3 = "1,2,3"
USER>w @("^abc("_temp3_")")
W @("^abc("_temp3_")")
^
<UNDEFINED> ^abc(1,2,3)