Skip to main content
16-Pearl
August 9, 2023
Solved

How to add json data to an infotable

  • August 9, 2023
  • 1 reply
  • 2410 views

I'm currently using the following lines to create an infotable from json:

 

 

	var json = {
		rows: jsonData.run_history, //an array of objects
		dataShape: DataShapes["SomeDataShape"].GetDataShapeMetadataAsJSON()
	};
 
	///////////////////
	//Loads json data to an infotable
	var data = Resources["InfoTableFunctions"].FromJSON({
		json: json
	});

 

 

I'd like to add more data from jsons to the infotable, but the FromJSON service replaces the previous data.  Is there a service that adds JSON data to the infotable?  Kind of like .AddRow?  I'd like to avoid using a for loop to add each row one-by-one as there are many rows.  Also, is there a limit to the size (MBs) of the infotable?

Best answer by Velkumar

Hi @Willie 

 

If you want to merge two infotable with same datashape, use the Union function

 

let params = {
 t1: infotable1/* INFOTABLE */,
 t2: infotable2/* INFOTABLE */
};

 

// result: INFOTABLE
let result = Resources["InfoTableFunctions"].Union(params);

 

For different datashape please refer to his article - Article - CS237109 - How to Merge InfoTables in ThingWorx (ptc.com)

 

I don't think InfoTable has any size limitation based on my experience.

 

/VR

1 reply

Velkumar19-TanzaniteAnswer
19-Tanzanite
August 10, 2023

Hi @Willie 

 

If you want to merge two infotable with same datashape, use the Union function

 

let params = {
 t1: infotable1/* INFOTABLE */,
 t2: infotable2/* INFOTABLE */
};

 

// result: INFOTABLE
let result = Resources["InfoTableFunctions"].Union(params);

 

For different datashape please refer to his article - Article - CS237109 - How to Merge InfoTables in ThingWorx (ptc.com)

 

I don't think InfoTable has any size limitation based on my experience.

 

/VR

Willie16-PearlAuthor
16-Pearl
August 10, 2023

Hi @Velkumar 

 

I forgot about that one.  Thank you.

 

Regarding the size of the infotable, I should have said the amount of memory used in a service.  In AWS Lambda, it can error if the the amount of memory used in the lambda function exceeds the amount of memory set for the lambda function.

19-Tanzanite
August 10, 2023

Hi @Willie 

 

I really don't have any idea about InfoTable Sizing for Lambda function. 

 

Please create PTC support ticket for this requirement

 

/VR