I am hoping someone could indulge my laziness regarding passing variant data types from TestStand 2013f1 to LabView 2015 SP1.
Since the "Anything" data type in TS and the variant data type in LV don't play nice, I have to manually pass the data type from TS to LV. I do this by adding an input to the VI that accepts a string description of the TS data type. I then use the "TypeOf" function in TS to get this string descriptor. This works well; however, I call this action many, many times with different data types. I worry that I will forget to update the TypeOf input every time I instantiate this VI. This would produce a run time error, which are annoying.
What I want is to autofill the TypeOf function with whatever Local, Parameter, etc I type into the variant (Anything) input of the VI.
I'm not a TS architect but I've poked around the API trying to see if there's anything that can provide this functionality. I am doubtful I can do this but I wanted to check with the community before I gave up.
Thanks for your help in advance.
Solved! Go to Solution.
Good news - you can do this!
Using the API, you can programmatically access the parameter information of the step.
If you know the parameter index of your container (x) and the name of the element in the container that you want to obtain the type of ("Data"), you can use the following expression in the "Data Type" parameter:
I hope this helps,
Thanks for this. I poked around the Step.Module API but didn't see AsLabViewModule. I just needed to scroll to the bottom.
I change the string you gave me to the following:
This ended up returning "Anything," which is the TS type for the "Data" parameter so I changed it to the following:
No matter what I set "Data" to (number, string, etc.), this always evaluated to "Expression."
It looks like this isn't going to work. The TypeName is literal.
Thanks for the help though!
Ah - yes, I understand now. My expression was getting the type of the LabVIEW parameter, whereas we want the type of the variable we are passing into LabVIEW!
This should work for you.
Yes, I tried this too but it always returns "Expression," which is useless. I plan on submitting a request to the TS Idea Exchange. Maybe Typeof can be updated to return more than "Expression."
I do know now how to achieve what I need using the TS API. It invloves parsing the string entered into the "Data" paramter. This parsed string will then be compare it against the list of variables used in the sequence to find the data type. It gets complicated because variables aren't always entered into the "Data" parameter or there could a scalar multipled with a vector.
I figured it out! I forgot that TS has an evaluate function. The final expression should be:
This gives me exactly what I'm looking for.
Haha! I missed the Evaluate in your second reply. I should have had my coffee before reading your reply.