3 Replies Latest reply on Jan 16, 2017 4:04 PM by cjones RSS
    cjones Explorer

    why getDataTableEntries doesn't work in java extension?

    So I'm trying to make a call of our dataTable in an extension so I can then get an ID out of it and add it to an event message. But if I try to use GetDataTableEntries or FindDataTableEntry then it errors out of the try block. The errors are not helpful. I think I am instantiating my DataTableThing incorrectly and so when I reference any of its methods it fails, I haven't found how in the docs/api but just found examples like that.

     

    The code is as follows:

    try{

    DataTableThing db = (DataTableThing) ThingUtilities.findThingDirect("myDataTable");

    if(db != null)

         log.info("Found the db");

    InfoTable myInfoTable = db.GetDataTableEntries((double) 500)); //this also does not work if I pass null

    log.info("Was able to get data table entries");

    }catch(Exception e){

         log.info("Couldn't get data Table entries");

    }

     

    I typed this out so if there are syntax issues feel free to ignore them.

      • Re: why getDataTableEntries doesn't work in java extension?
        ttielebein Collaborator

        What version of the extension developer are you using? I believe ThingUtilities is deprecated, but I can't find any documentation on it, so maybe not.

         

        You may want to try using the EntityUtilities class:

         

        DataTableThing myThing = (DataTableThing) EntityUtilities.findEntity("MyThing", ThingworxRelationshipTypes.Thing);

         

        Can you debug and see if your call to find the entity is returning something? What do the errors say?