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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Issue in Updating the values for an Particular Column in INFOTABLE !!

pshashipreetham
17-Peridot

Issue in Updating the values for an Particular Column in INFOTABLE !!

I have an INFOTABLE, with Column Names RT-1, RT-3, RT-2.

Issue 1: Client want the Order of the Fields/Columns to be RT-1, RT-2, RT-3.
Issue 2: 

 

 

var oldEntry = new Object();
oldEntry.RT-1= startDate; //ERROR, SINCE RT-1 has "-" in the middle.

 

 

 

Thanks !!

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
ACCEPTED SOLUTION

Accepted Solutions

Due to Pivot the Columns order got Changed, Since my datashape as Field name in order, I have Created an Datashape based empty INFOTABLE, then I merged it with the INFOTABLE who columns were not in Order, That solved my Issue.

 

//Create INFOTABLE based on DataShape
var params_forOrder = {
infoTableName : "InfoTable",
dataShapeName : "datashapeName" //Since DataShape has the Value Fields in Order, new Table will be in Ordered Columns
};
var table2 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params_forOrder);
table2.AddField({ name: "timestamp", baseType: "DATETIME" });
//table1 has unordered table
var params_Merge = {
	t1: table2, // Empty INFOTABLE 
	t2: table1 // Unordered INFOTABLE
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Union(params_Merge);

 

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.

View solution in original post

2 REPLIES 2

I created a infotable with column name RT-1, RT-2, RT-3 and I am able to add values for all the columns. I used below code,

var params = {
infoTableName: "TestInfoTable" /* STRING */
};

//result: INFOTABLE
var result = Resources["InfoTableFunctions"].CreateInfoTable(params);

var newField;


newField = new Object();
newField.name = "RT-1";
newField.baseType = 'STRING';
result.AddField(newField);

 

newField = new Object();
newField.name = "RT-2";
newField.baseType = 'STRING';
result.AddField(newField);

 

newField = new Object();
newField.name = "RT-3";
newField.baseType = 'STRING';
result.AddField(newField);

 

var newEntry = new Object();
newEntry["RT-1"] = "StartDate";
newEntry["RT-2"] = "Date";
newEntry["RT-3"] = "EndDate";
result.AddRow(newEntry);

 

Please check if above mentioned helps you achieve your use case.

Due to Pivot the Columns order got Changed, Since my datashape as Field name in order, I have Created an Datashape based empty INFOTABLE, then I merged it with the INFOTABLE who columns were not in Order, That solved my Issue.

 

//Create INFOTABLE based on DataShape
var params_forOrder = {
infoTableName : "InfoTable",
dataShapeName : "datashapeName" //Since DataShape has the Value Fields in Order, new Table will be in Ordered Columns
};
var table2 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params_forOrder);
table2.AddField({ name: "timestamp", baseType: "DATETIME" });
//table1 has unordered table
var params_Merge = {
	t1: table2, // Empty INFOTABLE 
	t2: table1 // Unordered INFOTABLE
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Union(params_Merge);

 

Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
Announcements


Top Tags