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

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

Generate Mashup XML with Parsed Excel as Extension

MA8731174
16-Pearl

Generate Mashup XML with Parsed Excel as Extension

Hi,

I’ve parsed an Excel file on the client using SheetJS and now have a clean JSON spec of the UI (fields, checkboxes, etc.). Next step: generate a Mashup XML from that spec and create the Mashup in ThingWorx automatically.

 

Results after parsing excel are as below. It gives complete results like how many widgets in one row and then width and height of that widget with all requried details which would be very helpful to now generate a mashupXML

 

 

MA8731174_0-1756103439120.png

 

What would you recommend? that how can i now write a file and upload it in thingworx. should i upload this as extension the parse excel code  and then get that results in mashup somehow and then bind it to another extension may be in nodejs to do this job for me to write xml and upload in thingworx.. I have confusions about it like how can nodejs create a file and then upload it in thingworx as extension. (i know how NODEJS can create file but in thingworx context i have confusions)

 

Thank you

 

ACCEPTED SOLUTION

Accepted Solutions

Hello,

 

In ThingWorx Mashups are code, so they have the same lifecycle as Things, Groups, etc. Unless your Excel templates change frequently, you shouldn't load them on your production system dynamically. Thus instead of wrapping it in a ThingWorx extension, I'd make it part of your build process, i.e.

 

  1. Store your Excel templates in your Git repo side-by-side with ThingWorx entities XML files,
  2. Generate mashup XMLs as the first build step,
  3. Package the entire XML bundle, including the generated XMLs, as an extension,
  4. Import that extension,
  5. Configure what needs to be configured.

 

If you don't want to redeploy your app when a template changes, you can still have it as part of a build process, completely outside of ThingWorx, just instead of step (3) above you'd package two extensions -- one with the app, and another one with those generated mashups. This way you can import the second without the first as frequently as you need.

 

Either way, making it a ThingWorx extension seems like unnecessarily complex route to me. You can have much more flexibility if you do it outside.

 

As for uploading an extension to ThingWorx via Node.js, I have an example in Bash / curl, hope it helps: https://github.com/vilia-fr/twx-cli/blob/main/twx#L250

 

/ Constantine

View solution in original post

2 REPLIES 2

Hello,

 

In ThingWorx Mashups are code, so they have the same lifecycle as Things, Groups, etc. Unless your Excel templates change frequently, you shouldn't load them on your production system dynamically. Thus instead of wrapping it in a ThingWorx extension, I'd make it part of your build process, i.e.

 

  1. Store your Excel templates in your Git repo side-by-side with ThingWorx entities XML files,
  2. Generate mashup XMLs as the first build step,
  3. Package the entire XML bundle, including the generated XMLs, as an extension,
  4. Import that extension,
  5. Configure what needs to be configured.

 

If you don't want to redeploy your app when a template changes, you can still have it as part of a build process, completely outside of ThingWorx, just instead of step (3) above you'd package two extensions -- one with the app, and another one with those generated mashups. This way you can import the second without the first as frequently as you need.

 

Either way, making it a ThingWorx extension seems like unnecessarily complex route to me. You can have much more flexibility if you do it outside.

 

As for uploading an extension to ThingWorx via Node.js, I have an example in Bash / curl, hope it helps: https://github.com/vilia-fr/twx-cli/blob/main/twx#L250

 

/ Constantine

slangley
23-Emerald III
(To:MA8731174)

Hi @MA8731174 

 

If you found the response from Constantine helpful, please mark it as the Accepted Solution for the benefit of other community members.

 

If you still have questions, please let us know.

 

Regards.

 

--Sharon

Announcements


Top Tags