6 Replies Latest reply on Apr 24, 2017 4:38 AM by yding RSS
    yding Explorer

    How to update a row in an infotable?

    Hi,

    I use the method UpdateQuery to update a row in an infotable.

     

    When I test the service, it worked. But the row in the infotable had not been changed. I checked the query result and the updateQuery result, and they worked. But the data in the infotable was not updated.

    ----------------------------------------------------------------------------------------------------

    // MN_FamilyMemberData entry object

    var newEntry = new Object();

    newEntry.birthday = birthday;// DATETIME

    newEntry.accountId = accountId;// STRING

    newEntry.healthCondition = healthCondition;// STRING

    newEntry.personalPhone = personalPhone;// STRING

    newEntry.gender = gender;// STRING

    newEntry.socialSecurityNumber = socialSecurityNumber;// STRING

    newEntry.memberName = memberName;// STRING

    newEntry.ID = ID;// STRING

    newEntry.height = height;// NUMBER

    newEntry.memberId = memberId;// STRING

    var params = {

      infoTableName : "newInfotable",

      dataShapeName : "MN_FamilyMemberData"

    };

     

    // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(MN_FamilyMemberData)

    var newInfotable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

    newInfotable.AddRow(newEntry);

     

    var query = {

        "filters": {

            "type": "AND",

            "filters": [

                {

                    "fieldName": "accountId",

                    "type": "LIKE",

                    "value": accountId

                }

                ,

                {

                    "fieldName": "memberId",

                    "type": "LIKE",

                    "value": memberId

                }

            ]

        }

    };

     

    var params = {

        t: me.FamilyMemberList /* INFOTABLE */,

        query: query /* QUERY */,

        values: newInfotable /* INFOTABLE */

    };

     

     

    // result: INFOTABLE

    Resources["InfoTableFunctions"].UpdateQuery(params);

     

    var params = {

        Code: 0 /* NUMBER */

    };

     

     

    // result: INFOTABLE dataShape: ReturnValueDefinitionData

    var result = Things["ReturnValueDefinition"].ReturnInfomation(params);

    ----------------------------------------------------------------------------------------------------------------------