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.

Need help with calculating preceding Monday in FMP 16

Featured Replies

I have a script to find records by date, and would like to just include records from the current week, starting on Monday. Meaning, if today is Wednesday, I would like it to include records for the current week Monday - Wednesday.

I searched online, and while I did find 1 page that discussed this very thing, I could not make it work.

Their suggestion was:

Div ( date - 1 ; 7 ) * 7 + 1

which I presume the date refers to a date field?

I added it to my script as:

 

Div ( Get ( CurrentDate ) - 1 ; 7 ) * 7 + 1 & "..." & Get ( CurrentDate )

But that returned a number instead of a date (737696...10/4/2020) which failed.

Can anyone help me out with this?

 

Try setting the field to:

GetAsDate ( Div ( Get ( CurrentDate ) - 1 ; 7 ) * 7 + 1 ) & "..." & Get ( CurrentDate )

 

  • Author

That worked Beautifully. Thanks!

  • Author

I spoke too soon. It looked like it would work (I put a pause/resume step in to see what it entered in the date field) and the correct range was entered, however when the search happens it just returns all records.

During the pause, the range in the date field is 10/5/2020...10/5/2020

but when I resume, it changes to 10/5/2020 *:*:*...10/5/2020 *:*:* 

which then just returns all records.

What do the colons and asterisks mean?

 

It looks like the searched field is a timestamp field, not a date field. Still, it wouldn't explain why all records are found.

 

  • Author

Ahhh. you are right, it is a time stamp field. Didn't think that would make a difference.

When I manually type in 10/5/2020...10/5/2020 the search happens like I expected it to.

Is there a different approach I should take to search a range in a time stamp field?

 

2 minutes ago, djeans said:

When I manually type in 10/5/2020...10/5/2020 the search happens like I expected it to.

I believe that if you do that, and then select Records > Modify Last Find, you will see that the hours, minutes and seconds were automatically filled for you with wild cards - same as in your scripted search.

 

  • Author

Nevermind. I figured it out. 

I had an extend found set step after it that was written wrong. Dumb mistake.

 

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.