4 Replies Latest reply on Feb 27, 2017 8:21 AM by aelgov RSS
    aelgov Apprentice

    Can't add row for infotable in runtime

    Hi,

     

    I want to create new infotable from datashape, then add rows to it.

    I get an error:

     

    JavaException: com.thingworx.common.exceptions.InvalidRequestException: Invalid Reference to Object In Script

     

    This is the code I use:

     

     

    var params = {

      infoTableName : "InfoTable",

      dataShapeName : "MyInfoTableDataShape"

    };

     

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

     

    for(var i = 0; i < Logs.length; i++){

     

    var newEntry = new Object();

    newEntry.DateTime = logDateTime;

    newEntry.Reason  = log.Reason;

    myInfoTable.AddRow(newEntry);

    }

     

    var result = myInfoTable;

     

    When I add rows to an infotable property and add - var result = myInfotableProperty it works like a charm.