Skip to main content
1-Visitor
November 19, 2019
Solved

Valid DeriveFields expressions

  • November 19, 2019
  • 1 reply
  • 2377 views

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,

Best answer by abrigode

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.

1 reply

abrigode12-AmethystAnswer
12-Amethyst
November 19, 2019

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.

BradC1-VisitorAuthor
1-Visitor
November 21, 2019

Thanks @abrigode for confirming that.