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

How to print data (JSON) from ThingWorx?

Highlighted
Level 4

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

Re: How to print data (JSON) from ThingWorx?

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

Thanks,

-- Craig A.