· Mar 30, 2022

Possible to cast a global and all child nodes/values to an object in .NET?


Using ^TESTGLOBAL as an example, if my data structure is as follows:

2:  ^TESTGLOBAL(0) = "TEST DATA^99U^123456^123456"
3:  ^TESTGLOBAL(1,0) = "1^2^12345"
4:  ^TESTGLOBAL(1,.092) = "A"
5:  ^TESTGLOBAL(1,.1) = "12B"
6:  ^TESTGLOBAL(1,.2) = 12345
7:  ^TESTGLOBAL(1,"AB",0) = "^99.94A^1234567.123456^2123"
8:  ^TESTGLOBAL(1,"AB",1234567.123456,0) = "6543210.123456^^6543210.123456^123456^72^AB 0123 45^^ABCDE 1^^65432^AA^^1234;CD(^123"
9:  ^TESTGLOBAL(1,"AB",1234567.123456,40) = "20.0^^12345.0000!12345.0000!1234!4321!!!123^123456^12!13!23!!!!U/L^1234567.01234^^^543^1^P1^^1"
10:  ^TESTGLOBAL(1,"AB",1234567.123456,"NBC") = 3
11:  ^TESTGLOBAL(1,"AB",1234567.123456,"ABC") = "1234567890"
12:  ^TESTGLOBAL(1,"AB",1234567.123456,"ABCD",0) = "^99.97A^1^1"
13:  ^TESTGLOBAL(1,"AB",1234567.123456,"ABCD",1,0) = "12345.0000^11^"
14:                      ^TESTGLOBAL(1,"AB",1234567.123456,"ABCD",0) = "^99.98A^1^1"
15:                      ^TESTGLOBAL(1,"AB",1234567.123456,"ABCD",1,0) = "99999.0000^9^12345678^^123^12345^^70^7^^^^1234"
16:                      ^TESTGLOBAL(1,"AB",1234567.123456,"ABCD","B","12345.0000",1) = ""

is there a way that I can just cast the whole global ^TESTGLOBAL or ^TESTGLOBAL(1,) and all of its child nodes and values as an object without needing to do for each loops in .NET? It just looks ugly and inefficient to do all these loops, as the only way I have seemed to be able to get all the child nodes of 1 are like so: 

(just an example but essentially nesting for loops until I get however many child nodes deep there are to parse the whole global). And if the child nodes can be an arbitrary number, how would I go about recursing through doing it this way? I feel like there must be a way to just cast ^TESTGLOBAL or ^TESTGLOBAL(1,) to a direct object that I can just manipulate and traverse as necessary but I'm not sure if I am just missing how.


Thanks in advance for any help,



Product version: IRIS 2020.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2020.1 (Build 215_0_21214)
Discussion (2)1
Log in or sign up to continue