NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Assign LabVIEWIOControl type variable to code module input as array element

Solved!
Go to solution

Dear NI TestStand community,

 

let me ask the following question.

 

I'd like to implement the following - to have in FileGlobals array of variables, and get values from them based on current TestSocket index.
Everything works fine, expect LabVIEWIOControl types inputs for code modules.
(a) While assigning value to the input, "Device Name" and "Session Number" values are not known -> thus, code module does not receive proper data, and does not work.

Array Element.png
(b) When variable is not in the array, then everything is assigned properly.

Correct Assigning.png
(c) Also, while assigning "Device Name" and "Session Number" separately, without assigning of "task/channels in" -> then it is assigned properly, but I'm not sure, whether it will work.

Not clear if work.png

 

My questions are:
1. Is it possible to set LabVIEWIOControl variable from array in a way as in variant (a)?
2. Will variant (c) actually work?

 

Thanks a lot in advance,

 

Sincerely, kosist90.

0 Kudos
Message 1 of 8
(2,654 Views)

What is the datatype of Task in the Array?  When I make an array of LabVIWEIOControls it works fine for me.

 

So basically I have a FileGlobal called  Systems and it is simply an array of LabVIEWIOControls. 

Then in my LV step I just put FileGlobals.Systems[0] and it works fine.

 

Can you send a screenshot of your fileglobal systems variable?

 

Thanks,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 8
(2,632 Views)

Thanks a lot for your reply!

Systems - is array of container, which contains Task + other data/containers. Task - is LabVIEWIOControl type.

I guess when it will be an array of LabVIEWIOControl types, then TestStand "knows", which type exactly to expect; so no error occurs...

0 Kudos
Message 3 of 8
(2,629 Views)

It shouldn't matter.  I just tried with a container that contained a LabVIEWIOControl as my array element and it worked fine. 

 

Can you post a screenshot of your FileGlobal that shows the data types?  It feels like Task isn't a LabVIEWIOControl.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 8
(2,621 Views)
Solution
Accepted by kosist90

I'm attaching a screenshot of what I did.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 5 of 8
(2,620 Views)

@~jiggawax~ wrote:

It shouldn't matter.  I just tried with a container that contained a LabVIEWIOControl as my array element and it worked fine. 

 

Can you post a screenshot of your FileGlobal that shows the data types?  It feels like Task isn't a LabVIEWIOControl.


Sure it is LabVIEWIOControl type. But from your last post I see the difference - I've got not initialized array, for which number of elements is set dynamically; and you've got array with explicitely set number of elements. And then it works. Thanks for help!

So this is working solution:

 

Works.PNG

 

and this one not (which is strange a bit, but...)

 

Empty Array.png

 

0 Kudos
Message 6 of 8
(2,608 Views)

First of all I think you are missing a "t" in the name of your VI.... Smiley Very Happy

 

Seriously though, this feels like a bug in TestStand.  I haven't tested it but I think it will work during run-time as long as you populate the array correctly.  However, it should be smart enough to know what the datatype is and not throw the Unknown Value error as long as you are using type defs.

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 7 of 8
(2,599 Views)

Actually, unfortunately it does not work during run-time - task value is empty...

0 Kudos
Message 8 of 8
(2,593 Views)