Skip to main content
1-Visitor
June 27, 2017
Solved

How to get difference between fields of an infotable which are of date time basetype and the solution is also of datetime base type

  • June 27, 2017
  • 2 replies
  • 2761 views

Hi all,

              I have a requirement where there are 2 fields of an infotable say data1 (basetype infotable) and data2(basetype infotable).


Now I need to create an infotable which is as such data1-data2


That is the elements of data2 must be subtracted from data1 and the result must be in answer.

How to achieve it?

Best answer by CarlesColl

You should do something like this:

var result = Resources["InfoTableFunctions"].DeriveFields({

  t: myInfotable,

  types: "LONG",

    columns: "differenceInMilliseconds",

  expressions: "dateDifference(data1,data2);"

});

2 replies

20-Turquoise
June 27, 2017

Hi, keep in mind that datetime is calculated in milliseconds, so you can use that for your math logic and then output the result in the datetime format again.

1-Visitor
June 28, 2017

You should do something like this:

var result = Resources["InfoTableFunctions"].DeriveFields({

  t: myInfotable,

  types: "LONG",

    columns: "differenceInMilliseconds",

  expressions: "dateDifference(data1,data2);"

});

vsrilekha1-VisitorAuthor
1-Visitor
July 10, 2017

Thanks a ton! It worked