Jump 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.

Principle behind a Date Calc

Featured Replies

Hi Everyone!

I needed to use Replace Contents (on a stand-alone system) through a set of newly migrated data to set a date field (DateTherapistPaid) with a date which is the last day of the *next* month based upon its ServiceDate, but if the ServiceDate is less than 8/1/2002, set the field with 9/30/2002. I created an unstored calc through field definition to view the results before I proceeded ... and also backed up.

I assumed I had to de-construct the date and re-construct it again? I searched Forum and to get the *last day* of a month, I need to find the *first* of the next month and -1? So I jumped 2 months forward. This calc does work.

The reason for my post is this: I want to learn the optimum way of utilizing calculations and my *solution* appears to be clunky. Was there a better approach I could have considered?

Case (ServiceDate < Date(8,1,2002), Date(9,30,2002),

ServiceDate>= Date(8,1,2002), Date(Month(ServiceDate)+2), Day(1)-1, Year(ServiceDate)

Formulas (particularly date formulas) are very difficult for me and I appreciate any feedback as I am attempting to understand the principles involved not just cut & paste someone else's solution. crazy.gif

That formula looks pretty good, although you don't need to put in the test for the second case: ServiceDate>= Date(8,1,2002), since any date that is not less than 8/1/2002, must by default be greater than or equal to 8/1/2002. So you can simplify the formula down to:

Case (ServiceDate < Date(8,1,2002), Date(9,30,2002), Date(Month(ServiceDate)+2), Day(1)-1, Year(ServiceDate))

  • Author

Oh that makes sense! Thanks Bob. wink.gif So the remainder of the Service Dates (>=8/1/2002) (result2) actually *becomes* the default result. I remember thinking that there would be no records left. I don't NEED a default result if there are no records remaining to deal with, correct?

Case ( test1 , result1 [ , test2 , result2 , default result]... )

Oh, here's another formulae I like now!! smile.gif

Create an account or sign in to comment

Important Information

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

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.