How to get difference between fields of an infotable which are of date time basetype and the solution is also of datetime base type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
Solved! Go to Solution.
- Labels:
-
Troubleshooting
- Tags:
- infotables
- services
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You should do something like this:
var result = Resources["InfoTableFunctions"].DeriveFields({
t: myInfotable,
types: "LONG",
columns: "differenceInMilliseconds",
expressions: "dateDifference(data1,data2);"
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You should do something like this:
var result = Resources["InfoTableFunctions"].DeriveFields({
t: myInfotable,
types: "LONG",
columns: "differenceInMilliseconds",
expressions: "dateDifference(data1,data2);"
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks a ton! It worked
