Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
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);
Hi Michael,
Assuming Number isn't a variable storing a string of base types, you will need to add quotation marks around Number.
Thanks,
Adam
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
Also please remember that BaseType declarations must be in all Capital letters.
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?
To add a field to any info table you can use...