Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calc Statement to give a Text Return

Featured Replies

I am trying to Create a Flag, as to notify me when a expiration date is flagged with some text.

The Calc Statement I am using is

If ( Get ( CurrentDate ) > Nurse Xdate + 340;"Expiring";If ( Get ( CurrentDate ) > Nurse Xdate + 365;"Expired";"") )

I am doing something wrong.

Thanks in advance.

If() only allows two choices, not three and nested If() is overkill. Use Case() instead and, for those records which don't match either Expiring or Expired, you don't need to enter a blank result of "". So your calc would be:

Case (

Get ( CurrentDate ) > Nurse Xdate + 365 ; "Expired" ;

Get ( CurrentDate ) > Nurse Xdate + 340 ; "Expiring"

)

Notice I reversed the criteria ... Case() will stop evaluating when it hits the first true so it would have produced Expiring on ALL Nurse Xdates > Get ( CurrentDate ) + 340.

Be sure to make this calculation unstored (in Storage Option).

LaRetta

Edited by Guest
Corrected

  • Author

If() only allows two choices, not three and nested If() is overkill. Use Case() instead and, for those records which don't match either Expiring or Expired, you don't need to enter a blank result of ""

So your calc would be:

Case (

Get ( CurrentDate ) > Nurse Xdate + 365 ; "Expired" ;

Get ( CurrentDate ) > Nurse Xdate + 340 ; "Expiring"

)

Notice I reversed the criteria ... Case() will stop evaluating when it hits the first true so it would have produced Expiring on ALL Nurse Xdates > Get ( CurrentDate ) + 340.

I hope you realize that there may be records on EACH side of this calculation period who will produce no result at all? I'm sure that is probably fine but I wanted to point it out. Also, be sure to make this calculation unstored (in Storage Option).

LaRetta

I guess what you are saying which I just found out is that if you type in Yesterday's date it still will show Expired. Not sure what to do about that I assumed it would count the days from the expiration date. I need to put some thing in to just show a blank if nothing is needed.

Well I started to address both sides of the calculation currently unidentified. But I removed it because it isn't needed, unless the logic of the calculation isn't right. So give me the rules again ... here is what currently is produced:

If today is 7/23/2008 and Nurse XDate is 7/26/2007 then one year has not passed but it is getting close. So the result is "Expiring." If today is 7/23/2008 and Nurse XDate is 7/21/2007 then the year has passed and it is "Expired."

A blank NurseXDate produces NO result and if the NurseXDate isn't due yet (it's still within the yearly period) then the date is blank.

How do we need to adjust it?

  • Author

Well I started to address both sides of the calculation currently unidentified. But I removed it because it isn't needed, unless the logic of the calculation isn't right. So give me the rules again ... here is what currently is produced:

If today is 7/23/2008 and Nurse XDate is 7/26/2007 then one year has not passed but it is getting close. So the result is "Expiring." If today is 7/23/2008 and Nurse XDate is 7/21/2007 then the year has passed and it is "Expired."

A blank NurseXDate produces NO result and if the NurseXDate isn't due yet (it's still within the yearly period) then the date is blank.

How do we need to adjust it?

Yeh you got it right! But when I put in the next xdate to be 7/2/09 It will still show expired. So there is a step missing or something a little off. Maybe it is using the current date for the next expiration date.

Make the calculation unstored and then check it again. Because when I put in 7/2/2009 as the Nurse XDate and today is 7/23/2008 then the calculation produces nothing. :wink2:

UPDATE: Also remember that I REVERSED the criteria in the calculation so check that again.

Edited by Guest
Added update

  • Author

Make the calculation unstored and then check it again. Because when I put in 7/2/2009 as the Nurse XDate and today is 7/23/2008 then the calculation produces nothing. :wink2:

UPDATE: Also remember that I REVERSED the criteria in the calculation so check that again.

I did and it is still showing expired. It will show expired on every thing. I unchecked the unstored. I just copied and pasted the calc in the field.

I suspect that your Nurse XDate is set to text and not date.

  • Author

Case (

Get ( CurrentDate ) >Nurse Xdate + 365 ; "Expired" ;

Get ( CurrentDate ) > Nurse Xdate + 340 ; "Expiring"

)

This is what I put in.

  • Author

That was it I had it set to text.

Thanks,

Would like to be able to use your expertise more often.

Visit FM Forums as often as you like, Randy. There is no charge and you will find an incredible bunch of talented Developers here, giving of their precious time to assist.

LaRetta :wink2:

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.