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.

Week Ending value list - auto

Featured Replies

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!

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 &

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

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

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

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.

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.