5 Replies Latest reply on Jan 15, 2018 10:24 PM by michaelfr RSS
    michaelfr Creator

    Adding Column to Infotable

    I'm trying to add a column to an infotable I created using the DeriveFields snippet however I am receiving the error Wrapped java.lang.IllegalArgumentException: No enum constant com.thingworx.types.BaseTypes.org.mozilla.javascript.IdFunctionObject@1b2d8c9c Cause: No enum constant com.thingworx.types.BaseTypes.org.mozilla.javascript.IdFunctionObject@1b2d8c9c


    I'm also not sure what to put under the expressions area.


    My code is as follows.


    var paramss = {


    t: WasteTable /* INFOTABLE /,</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>columns: "Week" / STRING /,</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>types: Number / STRING */,

        expressions: '1'



    // result: INFOTABLE

    var result = Resources["InfoTableFunctions"].DeriveFields(paramss);



      • Adding Column to Infotable
        adam Creator

        Hi Michael,


        Assuming Number isn't a variable storing a string of base types, you will need to add quotation marks around Number.



        • Adding Column to Infotable
          adam Creator

          To answer your second question:

          DeriveFields is used to add additional fields to an info table based on an expression (ie. calculation). For example, if you wanted to add the values of two fields together, the value of expression would be:  myInfoTable.col1 + myInfoTable.col2

          Is that what you're trying to do?

          – Adam

          • Adding Column to Infotable
            paic Collaborator

            Also please remember that BaseType declarations must be in all Capital letters.


            So "NUMBER" vs. "Number"

            • Adding Column to Infotable
              michaelfr Creator

              Thank you both for the help. I'm simply just trying to add a column to an existing infotable. The column names will be conditional based on a separate query. Basically, I will have the code go through the results in an infotable from a query and add the columns named after each result in the query. Is there a better snippet to use to add columns to an infotable since the columns I am trying to add will not need to do any adding from existing columns?