06-04-2024 01:23 PM
After a specific array index is selected, how does the code access the array value at the selected index? I don't see an index property in the array type. Thank you.
Solved! Go to Solution.
06-04-2024 03:17 PM - edited 06-04-2024 03:17 PM
Just to clarify, for an array control on the panel are you asking for the current value of the indexers, i.e. similar to the LabVIEW Index Values property?
Can you describe a little more about the behavior you are trying to achieve? I suspect you could use the JavaScript Library Interface to retrieve the value but curious what the workflow is to know if just being able to read the value is what is needed.
06-04-2024 03:33 PM
Hi Milan,
Yes, similar to the LabView Index Values property as long as it provides the current index value of the array. I've an array of text strings which are populated by retrieving file names with a specific suffix using a web service. The user of the G Web App then selects which of the file names is desired, and that is to be supplied to another web service. So when the user scrolls through the populated string array, whatever index is the currently displayed file name is the file name that I need to supply to the second web service. The current solution is to have a numeric control right next to the string array indicator, and select which string array index is desired using the numeric control after scrolling through the available file names in the string array. That's not optimal from a user experience; in fact it's quite awkward.
Thanks for your quick response, and I'll await your suggestion(s) on a better approach.
06-04-2024 04:14 PM - edited 06-04-2024 04:35 PM
The context is helpful, thank you! For having an array of strings where the user needs to perform selection I think you can get a better experience using the Tree control. You'll have to transform the data a bit to be an Array of clusters of strings but then the Tree control itself supports selection modes such as single / multiple as well as change events for when the selection changes as well as property nodes to see the current selected values.
06-04-2024 04:16 PM
Thank you. Can you point me to an example using the Tree Control?
06-04-2024 04:35 PM
Updated my last post to show an example and you can also see the Tree control docs.
06-04-2024 04:43 PM
Thank you very much! I'll come back if I have further questions.
06-04-2024 05:18 PM
Okay, I'm doing something wrong. I can't initialize the string cluster like you did statically; it needs to be built dynamically after the web service returns a comma-separated list of file names. This is what I have so far (the array logic is the current approach). I added a Tree containing a string indicator (this may be incorrect). Where am I going wrong?
06-04-2024 08:48 PM
By default the Tree uses the value written to a terminal to determine the wire type, i.e. how many strings to expect in the cluster.
If you don't use the terminal to set the initial data then I think the default is a cluster with two strings.
You can specify how many strings to expect by
Also, looking at your snippet it seems like the selection will be for file names, if you expect "\" characters in the strings please note that backslash characters ("\") in the first column / first string of the cluster are treated as paths and used to build a hierarchy. It's possible that:
06-24-2024 03:37 PM
I've been unable to dynamically build the Tree Control with file name strings, so for now I'm going to leave it as a numeric control right next to the string array indicator even though it's not a great solution.