01-11-2011 10:46 PM
I have created a script that stores information into an array. I want to print out each index of the array in my report, but in the header. Does anyone know the syntax I would need to access the array elements from the stylesheet?
Solved! Go to Solution.
01-12-2011
11:19 AM
- last edited on
11-05-2024
02:47 PM
by
Content Cleaner
Hi,
I believe this link tells how you can edit parts of the header in the report. Let me know if this helps out. Have a great day!
Best Regards,
Adam G
01-13-2011 10:36 PM
How do i access the elements of an array in the sequence file and include it in the report? I need to know what the "@XXX" is for the array element i'm trying to print out.
01-17-2011 01:30 PM
DL,
The following is copied from a KB that is still in work and not online yet.
1. Define a variable with the same name as the XML tag that you've
defined in your xsl. Both string and number variables work with the XML
generation. Parameters work as the best variables as you often want to
write to these values from other locations in your code.
2. Create an
ActiveX Action step. The reference in will be the location of your
variable. Ex. Locals, Parameters, FileGlobals, (or if in a container:
Parameters.MyContainer)
3. The Object Class is a PropertyObject and
you are calling the GetXML Method. Store the return value in a variable
(Locals.XML) and in the next step we will add that variable to the
header. Pass 0x95, 0, <XML Tagname>,
Parameters.ReportOptions.NumericFormat as your values in (again where
the XML Tagname is what you've defined as your variable in TestStand and
the tag in the xsl document).
4. Add a statement step with Parameters.ReportHeader += Locals.XML to add the generated XML code to the header.
The format to access the array will likely be <xsl:value-of select="Prop[@Name='myArray']/Prop[@Name='myArray']/Value[@ID='[2]']"/>
Let us know if you have more questions about setting this up in TestStand or XSL.
01-17-2011 10:26 PM - edited 01-17-2011 10:27 PM
Where do I pass in the Parameters.ReportHeader and Parameters.ReportOptions.NumericFormat from?
01-18-2011 07:56 AM
DL,
I apologize, I left out the most important information. This should be done in the ModifyReportHeader callback. You are going to want to override that callback with these steps. That callback should have those parameters specified.
01-18-2011 12:25 PM
I included my steps in the ModifyReportHeader call back and i can verify that the Parameters.ReportHeader is being populated with my data, but still nothing is outputting in the report. I've used the following xsl statement to read each element of my array.
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[0]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[1]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[2]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[3]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[4]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[5]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[6]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[7]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[8]']"/>
<xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[9]']"/>
01-18-2011 02:19 PM
Were you able to modify the report header to display a section for the array information? I mean do you have a field in the report that is either failing to display the array element or displaying the entire array? If not, follow the guidelines in the help topic Customizing the UUT Report Header.
01-18-2011 02:36 PM
I've modified the XSL to display the report header fields i want to show. for example,
|
|
|
|
|
I'm having trouble displaying the array element for each of these items. the data i want to print to my report is contained in a userInput[] array.
01-18-2011 06:54 PM
The code you posted looks correct. Let me walk back through it all again in different words and maybe we can find the problem.
In TestStand you will need to add the ModifyReportHeader callback. In this callback add two steps. The first is an ActiveX action step with the following settings:
Automation Server: NI TestStand API 4.2 (or whatever version you are using)
Object Reference: Locals (or the container you placed your array in)
Object Class: Property Object
Call Method (selected from drop down): GetXML
Parameters:
Return Value: Locals.XML
GenerationOptions: 0x95
InitialIndentation: 0
DefaultName: "userInput"
formatString: Parameters.ReportOptions.NumericFormat
Assuming you are using either expand.xsl or report.xsl. In the XSL file you need to insert the following lines of code just above the comment with the CREAT_UUTHEADER_INFO tag:
Note: I would recommend creating a new xsl file copied from the one you would like to edit. You can then select to use this file in the report configuration options.
<TR> <TD NOWRAP="NOWRAP"> <B> <LI> Array Value 0:</LI> </B> </TD> <TD> <B> <xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[0]']"/> </B> </TD> </TR> <TR> <TD NOWRAP="NOWRAP"> <B> <LI> Array Value 1:</LI> </B> </TD> <TD> <B> <xsl:value-of select="Prop[@Name='userInput']/Prop[@Name='userInput']/Value[@ID='[1]']"/> </B> </TD> </TR>
Continue this on for all new lines of the header you need to add.