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.

Featured Replies

Im having trouble with a script that involves calculating a month.

I have a field called "Assigned" that contains a date.

What i am trying to do is create a script of all records that were assigned 1 month ago, 2 months ago, 3 months ago.

So far, i have been able to figure out how to get the current date and take the month to subtracy by one like so:

Month (Get (CurrentDate)) - 1

Now if i were to set that calculation as a variable of lets say $1_Month, how would i tell the program that i want to see all records whose assigned dates meet the criteria of the current month - 1, which would be July?

Thanks

Edited by Guest

Try something like:


Enter Find Mode []

Set Field [YourTable::Assigned ; Let ( t = Get (CurrentDate) ; Date ( Month (t) - 1 ; 1 ; Year (t) ) & ".." & Date ( Month (t) ; 0 ; Year (t) ) ) ]

Perform Find []






Or, if you want to use a variable for how many months ago:





Enter Find Mode []

Set Field [YourTable::Assigned ; Let ( t = Get (CurrentDate) ; Date ( Month (t) - $monthsAgo ; 1 ; Year (t) ) & ".." & Date ( Month (t) - $monthsAgo + 1 ; 0 ; Year (t) ) )

Perform Find []

Edited by Guest

  • Author

I am able to get that to work correctly for 1 month back but anything over that does not appear to work correctly unless i am doing something wrong. I used your first example whoch worked for 1 month ago so i tried it for 2 months ago by changing the script to -2:

Let ( t = Get (CurrentDate) ; Date ( Month (t) - 2 ; 1 ; Year (t) ) & ".." & Date ( Month (t) ; 0 ; Year (t) ) )

That should give me all records with an assigned date of 7/1/09 - 7/31/09, but i am also getting records from June showing up. Am i using the script incorrectly?

For 2 months ago, it needs to be:


Let ( t = Get (CurrentDate) ; Date ( Month (t) - 2 ; 1 ; Year (t) ) & ".." & Date ( Month (t) - 1 ; 0 ; Year (t) ) ) 

BTW, it's still August around here, so two months ago would be June.

  • Author

Math is a little rusty, thanks. I'll give it a try

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.