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

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

Recommended Posts

Posted

Hi - schoolboy stuff this for you brainiacs but I'm new to this, especially scripting and calculations!

I need to make a value list that automatically determines the week ending dates for the year. Currently you just 'edit...' the list and input it manually, but I want FM to calculate it so I dont have to worry about getting it wrong! How on this earth do I do that?

i.e.

28-05-04

04-06-04

11-06-04

etc

If you can help it would be appreciated, I'm not built for FM, give me audio or design any day!

Posted

Hello John,

There are any number of different approaches you might use to achieve automated updates to the value list you have described. Here is one.

Define a new table called 'Resources' with only a single record, and with a number field called 'RefYear', a global date field called 'gDateTemp' and a text field called 'FridayDatesList'. Then set up a script called 'ReferenceDates' and define it along the lines of:

Freeze Window

Go to Layout [ Resources ]

If [ Resources:: RefYear notequal.gif Year( Get ( CurrentDate ) ]

Set Field [ Resources:B) RefYear; Year( Get ( CurrentDate ) ) ]

Set Field [ Resources::gDateTemp; Let(X = Date(1; 1; Resources::RefYear); X + 6 - DayOfWeek(X)) ]

Set Field [ Resources:: FridayDatesList; Substitute(GetAsText(Resources::gDateTemp); "/"; "-") ]

Loop

Set Field [ Resources::gDateTemp; Resources::gDateTemp + 7 ]

Exit Loop If [ Year(Resources::gDateTemp) notequal.gif Resources:: RefYear ]

Set Field [ Resources::FridayDatesList; Resources:: FridayDatesList &

Posted

If and when FileMaker fixes the problem with related repetitions, this will be much easier to implement and not require a script, as it doesn't in 5.5. For now it's your best option, unfortunately.

  • 1 month later...
Posted

Hello,

Sorry to pull this one out of the past, but I am trying to do exactly this is FMP 6 & I'm stuck. Can anyone tell me if it's possible & point me in the direction of how to do it?

Thanks so much,

Elizabeth

Posted

Thanks! That is perfect. I saw your other post about this but couldn't figure out how to change the index to increment by a week. I learn so much on this forum.

Again, thank you.

Elizabeth

Posted

Note that it is record dependent. If you want to get a list for a different year, you have to create a new record with your computer's date settings changed to a different year. Since the calculation must be stored for a value list, it will not update automatically when the date changes.

This topic is 7405 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.