1 Reply Latest reply on Jan 16, 2018 2:32 PM by mpagliotta RSS
    mpagliotta Apprentice

    Viewing and put in an infotable JSON file?


    I followed this document CS 179012 (https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179012&lang=en&source=snippet)

    for converting a json in an Infotable but it doesn't work.


    First of all i created a Json like that;


    name file "sample_json



    "ID" : "Nicolas",

    "SortAs"     : "22",

    "GlossTerm" : true,

    "Acronym"    : "Male",



    and i move it in ThingworxStorage folder.


    Using service LoadJson i do not see anything .


    I tried anyway to create a new service like that



    var params = {

                    path: "/ThingworxStorage/jsample_json.json" /* STRING */



    var jsondata = me.LoadJSON(params);


    var params = {

                    infoTableName : "InfoTable",

                    dataShapeName : "DS_test_jason"



    // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):iNFOTABLE(DS_test_jason)

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


    /reading json file and put it in infotable

    for (var elem in jsondata) {

    //for(var i=0;i<jsondata.array.length;i++){



    //   var newEntry = new Object();

    //   newEntry.ID = elem.ID;

    //   result.AddRow(newEntry); 

         result = InfoTable;





    The result is an infotable with its fields but without values for any fields.


    This extension https://marketplace.thingworx.com/Items/Parsley_Extension results alreay installed.

    I fina also this note: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS232916&lang=en&source=snippet , they give me another different example of Json Object :


    "name":{"name":"name","aspects":{"isPrimaryKey":true},"description":"Entity type name","baseType":"STRING","ordinal":1},

    "count":{"name":"count","aspects":{},"description":"Total Count","baseType":"INTEGER","ordinal":2}}}}


    and also they are talkng about using

    var result = Resources["InfoTableFunctions"].FromJSON(params);


    It is not clear the real procedure in order to achieve my goal.

    Can you help me ?


    I thought it was the same procedure like reading a text file but with different function.