03-31-2009 07:31 AM
Hi all,
I would like to convert an object of type variant to an array in TestStand. More specifically, I obtain data from an Excel sheet (calling various methods on different objects obtained from Excel's ActiveX, from within TestStand). This data is of type Variant (from the call to Range.Value2 property).
I know it's possible to convert this to a 2D array inside Labview (VariantToData), but can I also do it from within TestStand? If I don't use any conversion method and just assign the return value of Range.Value2 directly to a 2D string array, the data is not ordered the way it should be (namely the first array dimension corresponding to rows and the second to columns of the Excel table), and the index of the array starts at 1 instead of 0.
So, is there a VariantToData function equivalent in TestStand that I can use?
Thanks
Solved! Go to Solution.
04-14-2009 04:40 AM
Hi Zladidad,
welcome to our forums!
Unfortunately, I am not aware of any function within Teststand that could convert the data from variant to data. Where do you want to process the data? Where do you need the data?
Best regards,
Peter
04-16-2009 02:58 AM
Hi Peter,
Thanks for your reply.
As mentioned, I want to have the data read in from an Excel file. This data represents named parameter value vectors (i.e. each row is such a value vector). For such a vector, some values are used as parameters to be fed to my UUT, and some are to be used in my test sequence for both flow control and reporting-related tasks (i.e. print the parameter vector name etc.). The UUT itself is modeled as a LabView virtual instrument that is called from within my test sequence.
So, the test sequence processes an arbitrary number of rows, i.e. parameter value vectors, one at a time, and I have local variables in my sequence that represent the indices at which the various parameters are stored in any of the parameter value vectors, that is, those local variables just hold column indices to indicate which parameter is in which column. And, as mentioned, the rows and columns are supposed to be stored in a 2D array local variable of the sequence.
What I already have is a LabView virtual instrument that does the same job. But I wanted to see whether it's possible to use a TestStand sequence in order to replace the VI completely. To be honest, I found the VI solution a bit too tedious to maintain.
Thanks again.
04-16-2009 07:10 AM
Hi Zladidad,
the way I understand your application, you are basically bypassing Teststand's sequence model by storing your sequence information in the Excel sheet. Is that so? Could you maybe post an example file in order for me to understand your application better?
Have you looked at the various TestStand example sequence files? In my opinion, it would be easier to define the sequence in Teststand and just read parameters from the Excel sheet once, maybe store them in a local variable by using a LabVIEW step.
Regards
04-16-2009 09:36 AM
04-16-2009 10:36 AM
Hi Zladidad,
there is a built-in tool in Teststand that serves this exact purpose: It's the "Tools -> Import/Export Properties" dialog. You can save a file that contains your various parameters and then adapt copies of this file for different sets of tests and import those accordingly.
You can find one shipping example for this here: <TestStand Examples>\PropertyLoader\LoadingLimits\LimitsFromExcelFile\UsingCVI
Check the Teststand Help for more information. To add comments to your property file, you can follow this link.
I'm sure this could be a good option for you.
Regards
04-17-2009 06:45 AM
Hi Peter,
I tried it with the property loader and it works! Thanks a lot for helping.
Cheers
12-17-2009 11:12 PM
Thank you very much!
12-18-2009 02:44 AM
Hi WeilL,
unfortunately, there is no variant data type available in Teststand.
What you could do is to flatten the variant to string, save the data in a container in Teststand. This container could contain the data (string) and some information on how to handle the type (numeric or string). Then your other module would unflatten the string use this data and process it according to the type information.
Please also see this thread.
Also, your question would get more exposure if you started a new thread. This is a rather old thread.
Good luck with your application!
Happy Holidays!
Peter