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

How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Is there any way in composer where we can add new Template into the hierarchy of Templates which is already created?

8 REPLIES 8

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Hi Veena,

Not with the composer, but I did it before and it works:

  • Export the entity as XML ( Entity > More > Export )
  • Dupblicate the XML file ( just in case... )
  • Edit the XML file with a text editor
    • Search for <ThingTemplate baseThingTemplate="originalBaseTemplate"
    • change "originalBaseTemplate" with the desired base template
  • Import the new XML ( Import/Export > From File > Entities > Single File )

E voilà

This is not official, I've tested and worked without restarting Tomcat.

Best Regards,

Carles.

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Hi Veena,

It wouldn't be possible through the Composer, however, what Carles described above should work (i.e,. manually editing exported xml file and then re-importing it back into the system - be careful with keeping the syntax, of course).

Highlighted

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

The workaround you suggested work and points out a possible bug , as the intent is not to change the base template for the design . Thingworx should work to fail to through validation if xml is edited manually . Just like java bytecodes if changed manually , compiler fails it.

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Hi Ravi,

I don't think "java laws" applies here, we are working with a live not compiled system ( scripting like ) which runs forever and restarts should be avoided as much as we can. Better to not to validate XML export/import, just validate if the structure and data it's ok, but not this kind of integrity you are pointing out.

Just my two cents and my point of view.

Best Regards,

Carles.

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

In that case , Thingworx should allow to manually change the base template from Composer . However it does not allow . The  design Architect  must come to defend their design. Because I don't thing there is any issues in changing it by editing export . They should tell why they have chosen , of not letting people edit it through composer.

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Hi,

Yes the Design Architect will defend their design, and he/she may want to change it also, and without the chance of modifying baseTemplate he/she will have a big problem.

As you can change ThingShapes with Composer, and think a good new feature would be the ability to chance also the baseThingTemplate, precisely on any language you can do it, you always can change the base class of an entity ( on the programing language side, of course then you have to compile on a compiled language, as Java for instance )

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

Just a note, I tried this a Thing Template that had 5 levels of inherited thing templates. The Thing Template replaced was at the higher level, and it worked fine until about three levels down from that template, it did not inherit the properties correctly anymore. 

 

A simple example:

GenericThing Template inherited by Level0Template inherited by Level1Template inherited by Level2Template inherited by Level3Template inherited by Level4Template inherited by Level5Template --> Things created off of Level5Template

 

Level0Template was "replaced" by ReplacementTemplate as the BaseTemplate for Level1Template using the XML. The inheritance for the changed properties worked until Level3Template. At Level3Template, it was still showing the old properties, and this was also the case for Level4Template, Level5Template, and all the Things. 

 

Solved this by running EntityServices>RestartDependenciesForThingTemplate on the ReplacementTemplate. This "refreshed" the dependencies for the template and the updated properties then showed correctly for Level3Template and down.

 

I hope this might help someone in the future!

Re: How can we modify the Base Template Of another Template or Thing in Thingworx Composer?

WoW thanks! big inheritance chain ;)