Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to create a calendar?


This topic is 7270 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm looking to create a calendar from scratch. It seems like all the other solutions that offer this use a series of portals.

The main question is how is the mail calendar calculation work for months, years and days so they fall in the appropriate spots.

Hope my question make sense.

Thanks,

Michael

Posted

Hi,

I also looked at the "canned" calendar solutions and my problem was that they didn't work with IWP, mostly because of invisible buttons (at least, the ones I found).

So I am creating my own version (work in progress) that uses only one layout (no portals and no global fields). Basically, I have 42 number fields ("square_01_value", etc.) which have auto-enter calculations that depend on two fields: last_day_in_current_month and first_calendar_day_in_current_month, which in turn depend on current_month and current_year (they are all explained below).

These fields are grouped individually with embossed squares and arrange in a 7x6 matrix. At the top, I have an un-editable field that contains a concatenation of current_month and current_year and two buttons with the "<" and ">" symbols that simply add or substract a month (checking of course if we are in Jan or Dec to change the year as well).

Every time that the month value changes, all the values in the "square_NN_value" fields change accordingly (and it works perfectly for leap years).

Every grouped object (embossed square + field) has a button definition that calls a script that gets the value of the square field by parameter (Thanks to -Queue- this is now 1 script and not 42 scripts). This is because I use this calendar to help the user fill a date field (I wanted to avoid month/day vs day/month errors).

Here's how my calculations work:

First, "current_month" and "current_year" are seft-explanatory number fields. The next field, "last_day_in_current_month", avoids the "Thirty days hath September..." mnemonic. I think it is important, mostly for February (leap years are a pain to calculate). So I set this day as "next month's day zero" and FileMaker sets it as "this month's last day", like this:

last_day_in_current_month {calculation, number} = Day ( Date ( If ( current_month=12; 1; current_month+1); 0; If ( current_month=12; current_year+1; current_year)))

Then, "first_calendar_day_in_current_month" is used to set the first (and last) squares to blank ("") later (in the auto-enter calculations). Here's this field calculation:

first_calendar_day_in_current_month {calculation, number} = DayOfWeek ( Date ( current_month; 1; current_year) )

Finally, every "square_NN_value" field has a specific calculation that basically verifies it's relation with the first calendar day or the last day of the month and ends up with either a number or a blank (""), here are two examples:

square_05_value {number, auto-enter calculation} = If ( first_calendar_day_in_current_month < 6 ; 6-first_calendar_day_in_current_month; "")

square_37_value {number, auto-enter calculation} = If ( last_day_in_current_month >= 38-first_calendar_day_in_current_month ; 38-first_calendar_day_in_current_month; "")

It works in IWP like I wanted. Maybe it could be simplified (maybe with repetitions?)... Like I said, it is a work in progress.

Hope this helps.

-GerryGerry

  • Newbies
Posted

I have used CC Calendar Pro and found it to be incredibly customizable - I have adopted the format with several variations with great success. I can't remember what I paid for it, but it wasn't much and it has saved me HOURS of time. I recommend it VERY highly.

This topic is 7270 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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