Jump to content
  • 0

Display Icon when date field is 60 days from SysUTCDateTime()


Hiperf

Question

3 answers to this question

Recommended Posts

  • 0

Hi @Hiperf,

I agree with kpcollier`s comment. Please use 'day' instead of 'year'.

 

According to your description, the 'LeaseEndDate' date is in the future. Am I right? 

I am mentioning this, since the order of the arguments in the DataDiff() function matters.

For example, the  'LeaseEndDate' date is in the future and you need to calculate the the difference in days between this date and today.

 

Formula 1: DateDiff(day, [@field:LeaseEndDate], SysUTCDateTime()), where LeaseEndDate is 01/14/2023 and today`s date is 11/15/2022.

                       Output is -60 (so the output is a negative number)

Formula 2: DateDiff(day, SysUTCDateTime(), [@field:LeaseEndDate]), where LeaseEndDate is 01/14/2023 and today`s date is 11/15/2022.

                     Output is 60  (so the output is a positive number)

 

If you use this formula on the Submission form or Details page, you may use Virtual field that is set to Calculated Value and apply the formula there. 

For example, I used the "Continue next element on the same line" option to place the alert next to the field: 
dPVgxB6.png

I deleted the label for Virtual field: 
PhPpzLW.png

And applied the following styles in the Header section (disable HTML editor before pasting, change the number of Virtual field if needed, add the properties you need to apply)

<style>
span[id*="cbParamVirtual1"]{
  color: red !important;
}
</style>

 

Output: 

qkXL9BB.png

Hope this helps.
 

Link to comment
Share on other sites

  • 0
1 hour ago, Hiperf said:

I have a field called LeaseEndDate. I need to display an icon or the word ALERT when the LeaseEndDate is 30 days out from the current SysUTCDateTime() and another that is 60 days out. I know this is simple, but I have been beating my head against the wall trying to get it to work.

This is what I have so far:

CASE
WHEN DateDiff(year, [@field:LeaseEndDate], SysUTCDateTime()) BETWEEN 0 and 30
THEN 'ALERT 30!'
WHEN DateDiff(year, [@field:LeaseEndDate], SysUTCDateTime()) BETWEEN 31 and 60
THEN 'ALERT 60!'

ELSE''
END

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...