Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I wanted to calculate the difference between two timestamps (one being current time and another from the latest data refresh) and based on the value and source system, should make the column of the latest data refresh timestamp highlighted in red (for delay) or green (for normal).
Tried different calculations and if loops but doesnt seems to work right.
anyone could help?
Hi,
Where are you trying to calculate it? script or UI?
Should be prety straight forward, do you have some sample data, or would like to share the code you used?
take a look at this simple example that will work for you:
if(now()-now()-2/24<0,Red(),Green())
Now change the Now() and the Now()-2/24 with your timestamps, and that's it.
Eliran.
Hi, In the UI inside the Data-->Background color expression..
Sample code fyr! (along with this the same code should work for diff time delays as well)
IF TimeStamp(Now()) > (EVENT_TIMESTAMP + (2/24))
THEN
Red()
ELSE
Green()
Hi Eliran,
I have slightly modified your code and implemented as below. It works fine. However, I try adding two more Source Systems with a list in if condition and it is not working. Gave the combined condition code as well below. Could you please tell me where i went wrong?
If(SOURCE_SYS = 'A' AND (Timestamp(now())-EVENT_TIMESTAMP>2/24),Red()) -- working fine
If(SOURCE_SYS IN ('A','B','C'),
IF(Timestamp(now())-EVENT_TIMESTAMP>2/24) OR (Timestamp(now())-EVENT_TIMESTAMP>3/24),Red()) -- not working. here B and C both have same delay thresold of 3 hrs.
Hi Eliran,
USed below code and it works now.
If(SOURCE_SYS = 'A' AND (Timestamp(now())-EVENT_TIMESTAMP>2/24),Red(),
If(SOURCE_SYS = 'B' AND (Timestamp(now())-EVENT_TIMESTAMP>3/24),Red(),
If(SOURCE_SYS = 'C' AND (Timestamp(now())-EVENT_TIMESTAMP>3/24),Red())))
Thanks much!!