Skip to main content
1-Visitor
November 23, 2020
Solved

Regarding DeriveFields

  • November 23, 2020
  • 2 replies
  • 2572 views

Hi Team,

 

How can I use DeriveFields on an infotable? I have an infotable as shown below.

 

col1 col2
test name.hai
test2 name.hello
test3 name.hai
test4 name.hello
test5 hello

 

I want new infotable to me without the string "name." in the col2 field. The new col2 should have hai , hello only.

 

Regards,

Best answer by abhiramk

var params = {
types: "STRING"/* STRING */,
t: YOURINFOTABLENAME /* INFOTABLE */,
columns: NEWCOLUMNNAME/* STRING */,
expressions: col2.split(".")[1]/* STRING */
};

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

 

2 replies

22-Sapphire I
November 23, 2020

Not sure if this helps

https://community.ptc.com/t5/IoT-Tech-Tips/Powerful-Things-you-can-do-with-DeriveFields/m-p/535264

To remove the column, you can just drop the column from the infotable or not include it in the datashape in your output or just carry it but ignore it.

1-Visitor
November 23, 2020

Hi Pai,

 

Firstly thanks for the reply. My question is that I have to process the col2 data and remove some part of string from all the rows of col2. Can you let me know how can I proceed?

 

can you please let me know what these fields do or any example usage link.

 


var params = {
types: undefined /* STRING */,
t: undefined /* INFOTABLE */,
columns: undefined /* STRING */,
expressions: undefined /* STRING */
};

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

 

 

abhiramk1-VisitorAnswer
1-Visitor
November 25, 2020

var params = {
types: "STRING"/* STRING */,
t: YOURINFOTABLENAME /* INFOTABLE */,
columns: NEWCOLUMNNAME/* STRING */,
expressions: col2.split(".")[1]/* STRING */
};

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

 

Support
December 7, 2020

Hi @Bhanu_Manoj.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon