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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

JAVA SDK: Delete Data Shape Dynamically

ghecht
5-Regular Member

JAVA SDK: Delete Data Shape Dynamically

I am using Java SDK to create a Data Table dynamically.

During the creation process, I create a Data Shape dynamically.

I would like, in case of failure (exception thrown or other reasons), to delete the recently created Data Shape.

 

Is there a way to do that?

 

Thanks,

Guy Hecht

6 REPLIES 6
supandey
19-Tanzanite
(To:ghecht)

Hi Guy, i'm checking for this. I can see there is a service to list them out, but couldn't locate any delete service for DataShape specifically. 

 

Assuming you are using Java Extension SDK, please do correct me if you are working with Java Edge SDK.

supandey
19-Tanzanite
(To:ghecht)

Unfortunately there is no straight forward service to simply delete the DataShape so you'll have to surround the creation of DataTable with the try/catch block to handle any error/exception occurring during creation process. 

 

Would it be possible for you to share a short snippet of how you are handling it currently in your code?

 

 

ghecht
5-Regular Member
(To:supandey)

Are you sure that surrounding the creation of the data table with a try and catch block would work?

If the Data Shape was already created in thingworx by my code how will it be deleted?

I am currently using the try and catch mechanism but I was planning on calling the deletion service on the catch block.

 

Is there no way of deleting a general entity maybe, regardless of it's type?

supandey
19-Tanzanite
(To:ghecht)

Try/catch should handle any exception occurring during the creation process of the entity. For deleting any DataShape independent of the DataTable you are trying to create, i believe dispose() can be used - it'll need to be overridden in your template.

 

 

@Override
public void dispose() throws Exception { // TODO Auto-generated method stub super.dispose(); }

I haven't yet seen any "delete any entity" service, despite a service existing for listing any type of entity. I'll discuss about it and see if it can be taken up as enhancement request if there really isn't any available.

 

I already have a feature request pending for DataShape deletion Snippet... There's almost a Delete Snippet for any kind of entity, but not for DataShapes :(

supandey
19-Tanzanite
(To:CarlesColl)

Thanks Carles for highlighting. I found that enhancement request, adding link to the article here for reference https://www.ptc.com/en/support/article?n=CS231106 

 

Guy, I'll have an internal case open for you on this topic and will have that added to the enhancement request.

Top Tags