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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Generate PDF file containing table from JSON response, dynamically

kkgooner
5-Regular Member

Generate PDF file containing table from JSON response, dynamically

Hello everyone,

 

I am trying to create a custom extension in Thingworx which will generate a PDF file when a user clicks a button. The Thingworx mashup on which this button exists, will have a table full of data ( assume 100s of rows and 10 columns) which needs to be exported as a PDF report. In the mashup, the user has an option to select the duration for which the data in the table has to be displayed. The source for the data in the table is from a Json file from another system ( if it is relevant )

 

I have Created a PDF generation code in eclipse that creates a table with sample placeholder data. But I am unable to figure out how the table can be created dynamically based on the data in thingworx. For example, if the user selects report duration as two days, the PDF should contain rows for only two days of data. If the user selects 15days in mashup and click the button, then the report should have table amounting to data for 15days.

In short, the table structure should depend on the duration selected in Thingworx.

 

Apologies if this is a vague question, but any help/pointers will be greatly appreciated!

 

Thanks in advance 

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:kkgooner)

Hi @kkgooner.

 

There are some unknowns here but one way you could do this would be to store the data from the .json file in a stream which can be queried based on timestamps.  If you don't want to store the data in ThingWorx, is there some way you can request only the data needed from the external system?

 

Regards.

 

--Sharon

View solution in original post

4 REPLIES 4
slangley
23-Emerald II
(To:kkgooner)

Hi @kkgooner.

 

There are some unknowns here but one way you could do this would be to store the data from the .json file in a stream which can be queried based on timestamps.  If you don't want to store the data in ThingWorx, is there some way you can request only the data needed from the external system?

 

Regards.

 

--Sharon

kkgooner
5-Regular Member
(To:slangley)

Hello Sharon,

 

Thanks for your response.

Regarding your possible solution where you have said that we can store the json data in a stream and then query  it based on timestamps, can you confirm if you mean Thingworx value stream? Just asking because I have seen that it can be used for Time-series data, but need to explore on using it for my case here.

slangley
23-Emerald II
(To:slangley)

Hi @kkgooner.

 

Please review the information in the ThingWorx Help Center for understanding the differences between streams and value streams.

 

If you have further questions, please let us know.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @kkgooner.

 

If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others on the community.

 

Regards.

 

--Sharon

Top Tags