I would like to know if there is some way to dynamically refer to structure fields in a linked list.
I'm not sure how to word this, so I'll try and explain with a bit of code.
Code: Select all
Structure MyStructure
top.i
middle.i
bottom.i
EndStructure
Global fred.s
Global NewList myList.MyStructure()
fred = "middle"
Debug myList()\{fred} ; this would display the value of myList()\middle
I would simply like to refer to a field of an element by using a variable as the field name, such as myList()\{fred} where the variable "fred" contains the string "middle".
This would be particularly useful in a loop, where the original dataset has been read from a database, and depending on the value in a given record field, only a particular list element field needs to be read. This would eliminate a lot of repetition and multiple "if" / "select" statements.
Apologies for the vagueness, but irrespective of the origin of my request, the crucial point is regarding referencing list element fields.
Thanks in advance for any assistance.