Use variable to specify structure field
Hi, as a brief outline, I'm using a function to sort some data, held in an array of structures. Depending on what is passed to the function, it will need to sort based on a different field.
i.e. if "field1" is passed to the function, the function will sort based on structure.field1. If "field2" is passed, it will be sorted based on structure.field2.
The problem I'm having is using a variable to specify the structure field. How can I set it so that the code effectively reads
structure.variablevalue
depending on what is passed to the function as variablevalue.
Thanks in advance :)