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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Delete DataTable entries

praveenp
1-Visitor

Delete DataTable entries

Looking for service to delete DataTable entries with specific column matched values


Ex : delete ExampleDataTable where columnX ="some value"


Tried  which is deleting all the records. This is expected.

When I try to use DeleteDataTableEntries from DataTable > Services , getting the message 'Must have a datashape defined to add rows...'  .  Created the DataTable on data shape only but still getting the message. 




2 REPLIES 2

Hi Praveen, 

I was just testing a similar service that deletes DataTable entries based on the value of one or more collumns. In my scenario, I have a data table with a Username (primary key), email address and subscription date. When a user executes this service, he or she will be deleted from a subscription list. I used only two collumns out of three to delete the entry but I am sure it works only with the primary key. 


I used the service

DeleteDataTableEntry,

and my code looks something like this: 


var values = Things["BlogSubscribersTable"].CreateValues();


values.EmailAddress = Resources["CurrentSessionInfo"].GetCurrentUser().emailAddress; //STRING

values.UserName = Resources["CurrentSessionInfo"].GetCurrentUser(); //USERNAME


var params = {

values: values /* INFOTABLE*/

};


// no return

Things["BlogSubscribersTable"].DeleteDataTableEntry(params);



kirans
1-Visitor
(To:praveenp)

It worked with out primary key, now able to delete DataTable entries with specific column matched values

var values = Things["ClientName_Alerts"].CreateValues(); values.ClusterName = ClusterName; //STRING var params = {     values: values /* INFOTABLE*/ }; me.DeleteDataTableEntries(params);

Announcements


Top Tags