NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make container uninitialized container? like for array we have Locals.arrData={}

I am having one container it has complex data like cluster.

It has byte 1 , byte 2, byte 3 ..and so on upto 8.

In one test case it is expected that there will no response from DUT.

And the received container remains uninitialized. like uninitialized array.

In that scenario I want to set expected container container as uninitialized container.

but when I create a local variable in teststand for that container it shall have some numeric value like '0'.

 

 

I know for array we can set as locals.arrData={},

 

Can anyone tell me how to set for container?

 

 

 

 

0 Kudos
Message 1 of 3
(1,915 Views)

Your question doesn't make sense.  Because arrays are just pointers to memory it makes sense that they can be empty.  Containers are a whole different deal.  When a container is allocated it creates memory space for all of its members.  In your case some bytes.  Something has to be in the memory space.  So they just use the default values of the datatype when the space is allocated. 

 

If you want to change it to an empty container then you are literally changing the datatype.  Unlike an array where you are not changing the data type but rather just pointing to some empty space. 

 

Any reason you can't just use an Array?

 

 

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

For anyone stumbling across this question in the future, you can clear a container with a while loop in Teststand.

Let's say you have a FileGlobal called myContainer that you want to empty out.

  1. Create a while loop with the following condition:
    FileGlobals.GetNumSubProperties("myContainer") > 0​
  2. Inside the loop, insert a single statement that does the following Expression:
    FileGlobals.DeleteNthSubProperty("myContainer",0,0)​

     

In my example, a FileGlobal may not be the best place for the container to live, it may make more sense to be in a Local.

 

 

0 Kudos
Message 3 of 3
(120 Views)