开云体育

Proper ways to reference Global Arrays in Expressions to avoid symbol table errors


 

I can't find an example online or in past GIO postings that shows how to format arrays for use in LogixNG expressions.? No matter how I format them or the index they throw symbol table errors.? I haven't tested maps but I would expect the same issues.? I have no issues with arrays in actions... those are simple.? I can view the arrays are correctly written using the log local vars function.
?
These global objects are used between multiple cNGs;? my hope is to use the arrays directly in the cNGs vs. sharing global buffer vars.
?

CtrlStatArray is 40 cell global array
CtrlPointer is global integer var
These are lifted from FOR and IFTHENELSE structures in the same cNG.?
?
statements that work:
? ? ? ? ? ? ? ? ? ? E1? Local variable CtrlPointer is less than or equal "41"
? ? ? ? ? ? ? ? ? ! A1? Digital Formula: CtrlPointer++
????????????????? ! A1? Digital Formula: CtrlStatArray[CtrlPointer] = "ACTIVE"
????????????????? ! A2? Digital Formula: CtrlXmitArray[CtrlPointer] = 1
?
?
statements that fail (symbol table error):
? ? ? ? ? ? ? ? ? ? E2? Local variable CtrlStatArray[CtrlPointer] is not equal to "END"
? ? ? ? ? ? ? ? ? ? E3? Local variable CtrlStatArray[0] is not equal to "END"
?
--
Jim Moomaw
Portland, OR
- Willamette Model Railroad Club (WMRC)
- NMRA, Pacific NW


 

Jim,

Use ?a Digital Formula for the expression.
The console shows "-- match --" since arrays are zero based.

Dave Sand



----- Original message -----
From: "Jim Moomaw - PDX via groups.io" <JMOOMAW_COM=[email protected]>
Subject: [jmriusers] Proper ways to reference Global Arrays in Expressions to avoid symbol table errors
Date: Thursday, February 20, 2025 11:05 PM

I can't find an example online or in past GIO postings that shows how to format arrays for use in LogixNG expressions.? No matter how I format them or the index they throw symbol table errors.? I haven't tested maps but I would expect the same issues.? I have no issues with arrays in actions... those are simple.? I can view the arrays are correctly written using the log local vars function.
?
These global objects are used between multiple cNGs;? my hope is to use the arrays directly in the cNGs vs. sharing global buffer vars.
?


CtrlStatArray is 40 cell global array
CtrlPointer is global integer var
These are lifted from FOR and IFTHENELSE structures in the same cNG.?
?
statements that work:
? ? ? ? ? ? ? ? ? ? E1? Local variable CtrlPointer is less than or equal "41"
? ? ? ? ? ? ? ? ? ! A1? Digital Formula: CtrlPointer++
????????????????? ! A1? Digital Formula: CtrlStatArray[CtrlPointer] = "ACTIVE"
????????????????? ! A2? Digital Formula: CtrlXmitArray[CtrlPointer] = 1
?
?
statements that fail (symbol table error):
? ? ? ? ? ? ? ? ? ? E2? Local variable CtrlStatArray[CtrlPointer] is not equal to "END"
? ? ? ? ? ? ? ? ? ? E3? Local variable CtrlStatArray[0] is not equal to "END"
?
--
Jim Moomaw
Portland, OR
- Willamette Model Railroad Club (WMRC)
- NMRA, Pacific NW


 

Perfect.? That table wants to be somewhere in the online reference (unless I missed it).
?
--
Jim Moomaw
Portland, OR
- Willamette Model Railroad Club (WMRC)
- NMRA, Pacific NW