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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

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

vsrilekha
1-Newbie

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

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?

1 ACCEPTED SOLUTION

Accepted Solutions

You should do something like this:

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

  t: myInfotable,

  types: "LONG",

    columns: "differenceInMilliseconds",

  expressions: "dateDifference(data1,data2);"

});

View solution in original post

3 REPLIES 3
posipova
20-Turquoise
(To:vsrilekha)

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.

You should do something like this:

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

  t: myInfotable,

  types: "LONG",

    columns: "differenceInMilliseconds",

  expressions: "dateDifference(data1,data2);"

});

Thanks a ton! It worked

Top Tags