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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Valid DeriveFields expressions

BradC
7-Bedrock

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,

ACCEPTED SOLUTION

Accepted Solutions
abrigode
7-Bedrock
(To:BradC)

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
abrigode
7-Bedrock
(To:BradC)

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.

BradC
7-Bedrock
(To:abrigode)

Thanks @abrigode for confirming that.

 

 

Announcements


Top Tags