cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Read XML data and add to infotable

Newbie

Read XML data and add to infotable

This is my xml file

 

sk36_0-1576190246910.png

 

--------------------------------------------------------------------------------------------------------------

This is my code -

 

var xmlDocument= me.XMLReceivedMessage;

// create info table from data shape
var params = {

infoTableName : "infoTable",

dataShapeName : "US_NRV_Factory_Dash_QULIS_DataShape"

};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(xmlParserTable)
var infoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

// iterate through xml and add to info table
for each (var tag in xmlDocument.DataArea.QualityDeviationRemark) {
var newRow = Object();
newRow.ChassisNumber = tag.DataArea.QualityDeviationRemark.ChassisNo;
newRow.CreationDateTime = tag.DataArea.QualityDeviationRemark.CreationDateTime;
newRow.ProblemType = tag.DataArea.QualityDeviationRemark.ProblemType;
newRow.ProblemDetails = tag.DataArea.QualityDeviationRemark.ProblemDetails;
newRow.ReportingArea = tag.DataArea.QualityDeviationRemark.ReportingArea;
infoTable.AddRow(newRow);
}

// return info table

var result = infoTable;

 

Can someone please help me. It says no data each time I execute. 

4 REPLIES 4

Re: Read XML data and add to infotable

What's your intention:

- Do you need to read the data from the file

or

- Do you need your program to work.

 

In the first case: Use MsExcel to open the file. It reports that some schema's are missing, and offers to create them for you, then you get results.

In the second case: Make sure you get access to Volvo's schema's....

 

Success!
Luc

Re: Read XML data and add to infotable

Sorry I changed my xml file. I updated the new one. I am able to access the xml file. 

 

When I do this newRow.ChassisNumber = tag.DataArea.QualityDeviationRemark.ChassisNo;

 I do not get the data though. It gives me a infotable saying no data as output

Re: Read XML data and add to infotable

That's not a direct answer to my question...

 

And your 'updated xml file' is NOT a valid xml file, apart from the fact that it's a picture of file contents.

 

Here's a picture of (part of the) structure and data of your original file:

LucMeekes_0-1576191010215.png

(Start at the top right).

 

Highlighted
Community Manager
(in response to sk36)

Re: Read XML data and add to infotable

 

Hi @sk36

Can you please confirm which PTC product you are referring to so that I can move your post to the appropriate support forum?

 

Thanks!

Leigh

Announcements
Register Now!