Jump to content

Week Ending value list - auto

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

Recommended Posts

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?






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

Link to comment
Share on other sites

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); "/"; "-") ]


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

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

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

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