03-30-2023 04:51 PM - edited 03-30-2023 04:59 PM
Hello NI Community!
I am looking for tips to make assigning values to LabVIEW parameters within TestStand, via the API more efficient. My objective is to programmatically set many parameter values across many LabVIEW steps. Iterating through all the parameters for every new value I want to set (via LabVIEWModule.Parameters.Item.Index(i)) is very inefficient, especially considering most user know the names of their LabVIEW parameters, and not the index. Does there happen to be a method that I am missing that allows a user to set a parameter value by using a lookup string (instead of a param index)?
Below is a quick piece of example code I put together showing what currently feels like the best approach. I suppose it's not the worst piece of code to rely on but not being able to refer to a parameter by name seems a little odd, considering there are loads of TS API methods that do allow using lookup strings.
If no such method exists, I would benefit from learning how the parameter index is set (or viewed, or edited) at the time of developing the VI. That way I could let me code know which index I am interested in instead of iterating through.
Thanks in advance!
Jared
03-31-2023 12:38 AM
Hi Jared,
I am not completely sure, if this leads to the right direction:
In LabVIEW, the index of a connector on the pane is dependent on the actual connector pane layout used
https://www.ni.com/docs/de-DE/bundle/labview/page/lvhowto/scripting_configuring_connector_panes.html
I don't know, if this is the same when using the TS API. But it might be worth checking.
Oli
04-10-2023 06:25 PM
Thanks Oli_Wachno. The connector pane index was helpful. I resorted to an approach similar to what I mentioned in the first approach. Hopefully NI can make this easier in the future.
Jared