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.

repeating dates calc

Featured Replies

scheduling db:

Has anyone found a clever way to calc repeating date that are either sequential or non-sequential?

i.e.

Repeat event for the the next for days

repeat event every second day until

Repeat event every wednesday of the next two months

Currently I have a full calc list offsetting date + 1 day and then I calc some substitutes. It is a bit clumsy and limited to 365 lines (days)

I don't quite follow what you are trying to do. Could you give more details or maybe an example of what you want your calculation result to look like for a given input.

The only way I can think of is to have a database full of records (say and calendar where each record is a day of the year) and loop through them with a script checking the criteria. Create a related event record when the criteria is met.

Brute force, yes. Ugly, sure. Use lots of "Freeze Window" steps! But that's all I can think of.

  • Author

please I need more hope then that... this is the million dollar question, I am sure a ton of FM guys have been here many times... oh well I will post if I hit it.

Well, some of us still aren't quite sure what you're trying to do. You call it a calc, but it sorta sounds like a script that generates records.

As Bob suggested, if you tell us exactly what the input is and exactly what the output you want is, maybe someone here can devise a solution.

  • Author

sorry...

user enters a date which he would like that event to happen multiple time in various ways.

So say the user would like the event to repeat every second monday and friday for the following 22 weeks. I need to find those dates somehow. currently I have a list that is 365 lines, each line is date+1, date+2, date+3 etc. then I use a script and calc to find what i need, but this solution is a bit of a mess and limited to one year (not to mention - have you ever waited for FMP to check a 365 line calc after you press ok - pack a lunch!)

this is just one example, but if you open any calendar app you might have, check out the repeat options that is what I am trying to create.

THX

So, the user inputs a Date and a repeat spec? But then there would be infinite dates in the answer. Would you also put in an end date, or when do you stop?

So, guessing, the user inputs a start Date, an end Date and a repeat-spec and he gets out... what?... one record for each matching Date?... or a single calc'd field that has each of the matching Dates separated by returns?... or?

  • Author

Yes, A single calc'd field that has each of the matching Dates separated by returns.

Note in some repeat situations you may not have an end date. (i.e. repeat for 20 days).

The basic problem calls for a loop.

Since there's no loop construct in FMP calculations, the best you could do in a straight calculation is unroll the loop a specified number of times... so, it would be a substandard solution, and hideously ugly and impossible to maintain.

Another way that would be far less ugly would be a related file (as has already been mentioned). That has the advantage that you could use separate calcs and relationships to implement lots of different repeat specs in a fairly modular fashion. It would be fairly elegant... though, would have the theoretical disadvantage of being an unrolled loop... you have to pre-generate enough records. But practically, as small as the stored file will be, I think you can easily gen more than enough.

To use a proper loop, you have to resort to a script that populates the field. That doesn't suffer the issue of pre-generation, but has other disadvantages... such as what invokes the script and how do you avoid inconsistencies.

So, which method is more appropriate for your situation?

Create an account or sign in to comment

Important Information

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

Account

Navigation

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.