How to add fields to a "Load Table" result?

I would like to add one or more fields that are calculated at runtime to my “Load Table” result. In SQL I would have put this in my SELECT statement. (SELECT *, DATEDIFF(today, createdDate) as age)
I have tried everything that came to my mind to achieve this and I haven’t found a solution here in this Support Board.

What do I miss?

Hi @Jorg_Beyer ,

Fields that are calculated at runtime can be added using dynamic properties.
Unfortunately DATEDIFF function is not supported at the current moment by Data Service grammar. I have created an internal ticket BKNDLSS-28659 to add this function. As a temporal bypass you can use next expression for property now() - createdDate. Result of this expression will be amount in seconds between these two dates. Sorry for inconvenience.

Regards, Andriy

Thanks, I give it a try. Can I give this dynamic property a name in my query?

Yes, you can do it in the next was now() - createdDate as dateDiff

I have done this in codeless in the following way:

in DevTools I can see the changes to the data, but without a name
image

Is this not the way you suggested?

It is working now the way you suggested. Maybe it took some time to be reflected in the UI.

I do not get the right amount seconds. If I calculate the number of days based in this number the result is completely off. That makes it difficult to test. Any idea why this may be the case?

now(): 1655650706000
createdDate: 1648764000000
now()-createdDate as age: 287925826 (coming from load table)

Hello @Jorg_Beyer!

I just tried to reproduce this issue, but everything works correctly for me.
Could you please repeat this test and add screenshots of the logic and results in the console?

Regards,
Alexander

Logic:

Output:

Hi, @Jorg_Beyer

We’ve just updated cloud servers with a new DateDiff function discussed above. The correct syntax will be:

in props: DateDiff('2022/01/01', date1) where date1 is a column name from the requested table.
in whereClause: DateDiff(date(now()), date1) > 1

Could you kindly let us know whether fix works for you well?

Regards,
Marina

It looks like it is working correctly - at least with a couple of data records