Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

StructureType array


mauTE May 30, 2024 10:39 AM

Hi to All,

I have a question about the StructureType instruction. Below you can see a very simple program that uses a StructureType definition and a Public variable defines as a two elements array of structure. In loggernet or DevConfig I can see only the upper element and I cannot manipulate the structure fields. Now, in the CRBasic help I can read: 

“After a StructureType is defined, it is assigned to a structure. Structures may be declared as Public or Dim. When declared as Public, structures can be viewed and manipulated remotely, similar to constants in a ConstTable.”

Please, can you explain to me how can I “manipulate remotely” the structure?

StructureType (example)
A As Long
B As Float
C As Float
EndStructureType

Public mytest(2) As example

Public PTemp, Batt_volt

DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate.
DataInterval (0,15,Sec,10)
Minimum (1,batt_volt,FP2,False,False)
Sample (1,PTemp,FP2)
EndTable

'Main Program
BeginProg
mytest(1).A = 2
mytest(1).B = 5.2
mytest(2).A = 7
mytest(2).B = 5.7

Scan (1,Sec,0,0)

mytest(1).C = mytest(1).A + mytest(1).B
mytest(2).C = mytest(2).A + mytest(2).B

PanelTemp (PTemp,15000)
Battery (Batt_volt)

CallTable Test
NextScan
EndProg

Thank you very much

 

Log in or register to post/reply in the forum.