Skip to main content
1-Visitor
June 6, 2015
Question

Delete DataTable entries

  • June 6, 2015
  • 2 replies
  • 3329 views

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

    5-Regular Member
    June 9, 2015

    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);



    1-Visitor
    June 9, 2015

    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);