User bio
404 bio not found
Member since Mar 10, 2021

This solution will work because global variable is visible on all stack levels (local variable is not).

But you'd use process private global varialble ^||pasp("unitcode") instead of  ^pasp("unitCode") which is visible from all processes and you can have collisons in multi user environment.

What about this one:

ClassMethod Indirection() [ ProcedureBlock = 0 ]
 set TABLES(0)="EVEN" 
 set TABLES(1)="ODD"
 for i=1:1:100 {
   set table = TABLES((i#2)) 
   set @(table_"("_i_")")=i
   // Xecute alternative, same issue 
   ; set cmd = "set "_table_"("_i_")="_i 
   ; x cmd 
 }  set evenTotal=0
 set i="" for set i=$ORDER(EVEN(i)) QUIT:i=""  
   set evenTotal = evenTotal+EVEN(i) 
 zwrite evenTotal
Martin has no followers yet.
Martin has not followed anybody yet.
Global Masters badges: