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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to print data (JSON) from ThingWorx?

arosse
4-Participant

How to print data (JSON) from ThingWorx?

I would like to be able to print (physically, not PDF) a label from a ThingWorx mashup. The data I want to print is a table of values, so that could be presented inside a JSON object, looking like this for example:

  • Name: John Doe
  • Date: 2017/10/30
  • ID: 12345678

As I did not find any built-in ThingWorx widget to do this, my first idea was to develop a custom widget "PrintButton". It would use the Print.js JavaScript library, allowing to print a JSON object from a web browser. As a new JavaScript user, I encounter difficulties to code this, as I can't find a way to make the runtime render work. Would someone have the source code of the button widget? It would help me start on a good basis.

My first question is: is this a good approach, or should I rather develop a custom service in Java to do the print operation?

My second question is: if this is a good idea, how to add an external JavaScript library to an extension Eclipse project?

Thanks,

Antoine

1 REPLY 1
CRArko
17-Peridot
(To:arosse)

Hello, Antoine.

This post talk about how to parse JSON object data to get it into a ThingWorx service. It might serve point you in the right direction. Let us know if you have additional questions.

https://community.thingworx.com/message/45501#45501?&posno=7&q=print%20json&ProductFamily=ThingWorx&source=search

Thanks,

-- Craig A.

Top Tags