From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically adding field in array element

Solved!
Go to solution

Hello.

I'm trying to make a generic "engine" to generate test reports/certificates.

I've made a custom data type container Report Element, which I've used to make a local variable array of Report Elements called Report Element Array.

The data type contains some generic fields (element title string, element type string, etc.), and a container Element Data.

The idea is to increment the Report Element Array with Report Elements, and then fill the Element Data container with the fields from e.g. a Table Element container.

Either that,  or to just add a field in the Report Element with the data type Table Element.

 

But I can't find a way to add fields in a container programmatically.

 

Anybody knows if this is even possible?

0 Kudos
Message 1 of 2
(3,791 Views)
Solution
Accepted by topic author ojohnsen79

Found it!

Using a Statement step, pointing to the array of Report Elements by using the method NewSubProperty.

 

Ended up using the following statement:

Parameters.Report_Element_Array.InsertElements(GetNumElements(Parameters.Report_Element_Array),1,0),
Parameters.Report_Element_Array[GetNumElements(Parameters.Report_Element_Array)-1].NewSubProperty("Element_Data",PropValType_NamedType,False,"NSE_Report_Table",0)

 

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