2 Replies Latest reply on Jun 9, 2015 8:59 AM by kirans RSS
    praveenp Explorer

    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. 




      • Delete DataTable entries
        costinb Explorer

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



        • Delete DataTable entries
          kirans Newbie

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