cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Valid DeriveFields expressions

SOLVED
Highlighted
Regular Member

Valid DeriveFields expressions

Hi Everyone,

 

We are trying to fill in a thing name in the GetDesignTimePermission result infotable using the DeriveField snippet. 

var params = {
   type: "Thing" /* STRING */,
   maxItems: 1000000 /* NUMBER */
};

var result1 = Resources["EntityServices"].GetEntityList(params);
var result2 = Things[result1.rows[0].name].GetDesignTimePermissions(); //This is only for a single entity for testing purposes

var params = {
  types: "STRING" /* STRING */,
  t: result2 /* INFOTABLE */,
  columns: "EntityName" /* STRING */,
  expressions: "result1.rows[0].name" /* STRING */
};

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

However we are having trouble finding a valid expression. 

Error executing service GetDesignTimePermissionsforUser. Message :: Script evaluation error : ReferenceError: "result1" is not defined. (DSLCompiledExpressionProcessor#1) - See Script Error Log for more details.

What would be a valid expression to add the relevant thingname in a new column using DeriveFields?

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Valid DeriveFields expressions

Hi BradC,

 

I don't think you will be able to add the Thing name through the use of DeriveFields(). This infoTable function is listed in a calculations category and only seems to work with mathematical expressions in my testing.

 

DeriveFields() 

 

It may not be ideal but you can add a new column to your infoTable by using AddField() and writing logic to fill the cell value.

View solution in original post

2 REPLIES 2
Highlighted

Re: Valid DeriveFields expressions

Hi BradC,

 

I don't think you will be able to add the Thing name through the use of DeriveFields(). This infoTable function is listed in a calculations category and only seems to work with mathematical expressions in my testing.

 

DeriveFields() 

 

It may not be ideal but you can add a new column to your infoTable by using AddField() and writing logic to fill the cell value.

View solution in original post

Highlighted

Re: Valid DeriveFields expressions

Thanks @abrigode for confirming that.

 

 

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!