Skip to main content
Nov 23, 2020 11:41 AM UTC
Solved

Regarding DeriveFields

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,

abhiramkAnswer
Nov 25, 2020 2:18 PM UTC

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

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

 

5 replies

Nov 23, 2020 3:58 PM UTC

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.

Nov 23, 2020 4:05 PM UTC

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);

 

 

abhiramkAnswer
Nov 25, 2020 2:18 PM UTC

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

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

 

Dec 7, 2020 8:32 PM UTC

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