NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbee Question: How do I create an array of filenames in TestStand 2012

I would like to change the image used in a Message Popup window based on the calling sequence.

In the main sequence I would like to declare two local variables: one a string that contains the path to

the image folder and the other an array of image file names, the index of which is used to select the

image to be displayed in the message popup.

 

There is not a "filename" data type that I can find, but there is a string datatype and a "path" datatype.

 

How do I build an array of filenames that will have a relative path and specific filename?

 

For example, I would like the file path to point to a generic image folder,

and the filename to be the specific image to be used.

 

In the Message Popup, Step Settings, "Options" tab, I tried to use the "File By Expression" selection

for file source, but cannot seem to create a valid file name by concatenating the file folder variable name

with a image name string from the image name array.

 

Any ideas?

 

Thanks,

David W.

Melbourne, Florida

0 Kudos
Message 1 of 3
(2,895 Views)

You have to use array of strings.

 

Use a string variable to store the relative path

Ex : locals.relativepath = "c:\\temp\"

 

Use a array of strings to store the file names

example : locals.imagename[0] = "1.jpg" ,locals.imagename[1] = "2.jpg"


Add a statement before the message popup which will combine this two with the required if conditions.
Example :

locals.finalpath = locals.relativepath + locals.imagename[locals.num] ( here locals.num contains the pointer to the respective image name)


In the message step type - file by expression - select locals.final path for the image.


During the debug phase put a break point at the message step type and cross check if the file path formed is appropriate.

 

Hope this helps.

 

Message 2 of 3
(2,884 Views)

Hello, thanks for the kind reply.

 

I did indeed use a local variable for the path to the image folder, and an array of strings of file names to the individual image  files. This seems to work just fine. I originally got an error using the array as you suggested, but once the sequence was saved and re-loaded it worked fine.

 

 locals.relativepath + locals.imagename[locals.num]

 

 

 

0 Kudos
Message 3 of 3
(2,882 Views)