2 Replies Latest reply on Jun 2, 2017 4:54 AM by tlichtenberger-2 RSS
    tlichtenberger-2 Explorer

    How to change a value in a nested InfoTable?

    Good morning everyone!

     

    I have got one instantiated DataTable which inherits from the DataShape with the shape: Item(String, primary key) and SubItem(InfoTable)

    The SubItem-InfoTable has the shape: Name(String, primary key) and Location (Location: lat, long).

    The Datatable offers some services to add/update/delete entries, and I have used them to manually (via testing the service) add Items and SubItems (because there are indeed static and will not change). The only thing that changes (dynamically) is the Location property in the nested SubItem-InfoTable  but I do not know how to change the location property of one specific SubItem-Entry (the entry will be specified by the Name).


    I have already tried out the UpdateDataTableEntry/Entries-Services, but they would delete all the other SubItem-Entries which does not change.

    That is one problem. The other problem is to change the entries dynamically in a custom service.


    I have tried to write a service which gets 3 input-parameters: location(the new location), Item(the item which holds the SubItem in which the location must be changed), Name (for specifiying the SubItem-entry in which the location has to be changed.

    The service starts like followed:

    After the last line of code, I have to update the subitem-infotable with a new value but I do not know how to accomplish that.


    I would be very thankful if anyone could lend me some help!

    As always, thank you so much for your help! It is very much appreciated!

    Best regards,

    Theresa

      • Re: How to change a value in a nested InfoTable?
        Ankit Gupta Ninja

        Hi Theresa Lichtenberger,

         

        As per my understanding; you will have to read the entry of DataTable in an object; let's say row.

        So, row will have one property as SubItem-InfoTable.

        Now make the changes to the Infotable using UpdateQuery Service.

        var params = {
            t: undefined /* INFOTABLE */,
            query: undefined /* QUERY */,
            values: undefined /* INFOTABLE */
        };
        
        // result: INFOTABLE
        var result = Resources["InfoTableFunctions"].UpdateQuery(params);
        

        So, now row object has the updated Data.

        Now use UpdateDataTableEntry to update the row entry in the Datatable.


        Do let me know if you face any further issue.