Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

What NOW() function will output??

stalwar1s@@@@@who knows what the now function used below in my expression will produce??

IF(TICKET_STATUS = 'WORK IN PROGRESS' OR TICKET_STATUS='HOLD' OR TICKET_STATUS='ASSIGNED' OR TICKET_STATUS='NEW',

IF(TIER='GOLD' AND NOW()>RESOLVE_BEFORE,'OUT_OF_SLA','IN_SLA'),

IF(TIER='SILVER',

IF(DECODE_PRIORITY ='High' AND (NOW()+2)>RESOLVE_BEFORE,'OUT_OF_SLA',

IF(DECODE_PRIORITY='Medium' AND (NOW()+7)>RESOLVE_BEFORE,'OUT_OF_SLA',

IF(DECODE_PRIORITY='Low' AND (NOW()+10)>RESOLVE_BEFORE,'OUT_OF_SLA','IN_SLA')))))

I want the number(2) in  (NOW()+2) to be in DAYs and not HOURS??

e.g NOW()+2DAYS

92 Replies
sunny_talwar

what do you mean? I am not sure I understand you want to apply this to +7 alone?

Not applicable
Author

Hi Sunny,

  It doesn't really Matter, but hwhere do I wrap the LastWorkingDate() in the code below ??? I tried it and its giving me errors.

If(Match(TICKET_STATUS, 'WORK IN PROGRESS', 'HOLD', 'ASSIGNED', 'NEW'),

  If(TIER = 'GOLD',

      IF(Now() > TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA','IN_SLA'),

      IF(TIER = 'SILVER',

        IF(DECODE_PRIORITY ='High' AND NOW()>(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT')+2),'OUT_OF_SLA',

            IF(DECODE_PRIORITY='Medium' AND NOW()>(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT') +7),'OUT_OF_SLA',

            IF(DECODE_PRIORITY='Low' AND NOW()>(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT') + 10),'OUT_OF_SLA','IN_SLA')))))) as OPEN_SLA

sunny_talwar

from my understanding, may be this:

If(Match(TICKET_STATUS, 'WORK IN PROGRESS', 'HOLD', 'ASSIGNED', 'NEW'),

  If(TIER = 'GOLD',

      IF(Now() > TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'),'OUT_OF_SLA','IN_SLA'),

      IF(TIER = 'SILVER',

        IF(DECODE_PRIORITY ='High' AND NOW()>(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT')+2),'OUT_OF_SLA',

            IF(DECODE_PRIORITY='Medium' AND NOW()>LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'), 7),'OUT_OF_SLA',

            IF(DECODE_PRIORITY='Low' AND NOW()>(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT') + 10),'OUT_OF_SLA','IN_SLA')))))) as OPEN_SLA

Not applicable
Author

Hi Sunny,

  This is a weird question, cause I shld have known by now, lets say I wanna test that line and see the output, how do I go about it ??

sunny_talwar

Just that line? I don't think it would be possible. I think you will have to run the whole application and look for a row that match the criteria and see if the result is what you expect.

Not applicable
Author

it is working fine now, but isn't there anyway, I can see the exact day(In date) the LastweekDate() made the code to become??

sunny_talwar

Oh ya, you can add another field in your script like this

LastWorkDate(TimeStamp#(SubField(RESOLVE_BEFORE, ' ', 1) & ' ' & Trim(Mid(RESOLVE_BEFORE, Len(SubField(RESOLVE_BEFORE, ' ', 1)) + 1)), 'MMMM DD, YYYY hh:mm:ssTT'), 7) as TestTestTest

Now create a table with two fields

RESOLVE_BEFORE

TestTestTest

and see there relationship

Not applicable
Author

hmmm Sunny,

   I envy you really. You're so good, its working. Thank you.

sunny_talwar

Its all trial and error my friend . I don't hesitate in trying. What do you have to loose here by trying, right?

sunny_talwar

One last thing, for any additional thing, I would suggest you to create a new thread as it is not very helpful for other users when a thread becomes extremely long. Although all your questions were related to your initial question, but breaking it out might help in two ways

1) Your question will get greater exposure

2) Future visitors won't have a difficult time to understand the thread.

Best,

Sunny