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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Read XML data and add to infotable

sk36
3-Newcomer

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
LucMeekes
23-Emerald III
(To:sk36)

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

sk36
3-Newcomer
(To:LucMeekes)

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

LucMeekes
23-Emerald III
(To:sk36)

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).

 

Leigh
Emeritus
(To:sk36)

 

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

Top Tags