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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Is there any option to have DataShape template to other Datashapes?

Janakiraman-P
14-Alexandrite

Is there any option to have DataShape template to other Datashapes?

Hi,

 

I'm creating entities for 100+ Machines where as each Machine has some common and unique information to be stored/accessed from DataTable. For creating DataShapes for those DataTables, there are 17 common attributes and as per Machine it may have 5-10 additional attributes.

 

If I could get a chance to create a template with the 17 common attribute which will eliminate unnecessary name changes, naming conventions and will help me to have neat and generic code style. 

 

As of now I following one generic service to create datashape with 17 common fields by getting datashapeName as Input. In Future, if I eliminate or includes one common attribute, it will come to me as a rework for all the entities.

 

So, How can I avoid this? or Is there a possible way to have a DataShape template?

 

Please help.

 

 

Thank you,

Janakiraman P

ACCEPTED SOLUTION

Accepted Solutions

@Janakiraman-P ,

 

One more thought building off of @TravisPickett 's idea is to Tag all of the datashapes that have your common datashape columns (with the same tag).  Then when you want to add a "Common" column to all of them, write a service that queries all of the DataShapes with that tag and loops through them to add/delete common columns.  That might actually be the easiest way to do it.

View solution in original post

6 REPLIES 6

Hi @Janakiraman-P,

 

I understand the point of your request, however as of today DataShapes do not have the capability to implement templates/other DataShapes.

 

To request this functionality, refer to Product Ideas @ PTC Community

 

Thanks !

Hi @Janakiraman-P,

 

You can sort of accomplish this via code.  You can create a "template" data shape and then create the additional data shapes by code.

 

In your service do the following:

  1. Call GetDataShapeMetadataAsJSON() on your "template" data shape
  2. Modify the resulting JSON by adding your data shape specific fields
  3. Call CreateDataShape on EntityServices using the modified JSON as the fields value

Unfortunately if you have to make updates to the template data shape you will have make this manually to your other shapes or code the updates.  For more assistance creating data shapes via code you can see the following community post.

 

Thanks,

@Janakiraman-P ,

 

Another way you could do this is having an InfoTable as one of your 'inherited' DataShape columns.  In other words, create your base DataShape (I'll just call it CommonShape) and then for your 'inherited shapes', add an InfoTable column with the DataShape as CommonShape.  Then it should keep up with any updates you make to CommonShape.  The only downside that I can see is that you have to reach one level deeper in your infotable to get to the Common properties and it may preclude you from using it in some mashup widgets. 

Janakiraman-P
14-Alexandrite
(To:nmilleson)

Hi @nmilleson @TravisPickett @c_lowy ,

 

Thanks for the responses,

 

@nmilleson I take your suggestion to try out the best I can do for this.

 

I have to validate on these,

 

1.I usually upload csv data as base data for my DataTable, in your case I should have two csv's to achieve this, I guess.

 

2.How data can be represented in Grid, Collection, Graphs and other such widgets are already in use.

 

3. Selected row's info..., and more.

 

Will come back, if any.

 

Thanks,

Janakiraman P

 

@Janakiraman-P ,

 

One more thought building off of @TravisPickett 's idea is to Tag all of the datashapes that have your common datashape columns (with the same tag).  Then when you want to add a "Common" column to all of them, write a service that queries all of the DataShapes with that tag and loops through them to add/delete common columns.  That might actually be the easiest way to do it.

Janakiraman-P
14-Alexandrite
(To:nmilleson)

Hi @TravisPickett @nmilleson 

 

Thanks for the suggestions, services approach might work I guess.

 

 

 

Regards,

Janakiraman P

Announcements


Top Tags