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

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

Recommended Posts

  • Newbies
Posted

I am trying to write a script that will find records when looking in a date field (formatted as date) that is today minus 3 years (to the exact date). I have to run this every month.

Help is appreciated!

Posted

Allow User Abort [Off]

Set Error Capture [On]

Enter Find Mode [ ]

Set Field [datefield; Let( T = Get(CurrentDate); Date( Month(T); Day(T); Year(T) - 3 ) )]

Perform Find [ ]

If [not Get(FoundCount)]

Show Custom Dialog ["No records for that date exist."]

End If

Or create an unstored calculation date field of Let( T = Get(CurrentDate); Date( Month(T); Day(T); Year(T) - 3 ) ) and a relationship from this field to your date field. Then a script like

If [isEmpty(relationship::serial)]

Show Custom Dialog ["No records for that date exist."

Else

Go to Related Record [show only related; "relationship"]

End If

Posted

"today minus 3 years (to the exact date)"

So if today was 29 February 2004, what date should the calculation return?

  • Newbies
Posted

It worked - thanks a million!

Is there any good resource for scipts that give examples? I used to do a bit of Visual Basic but it's been a while...there's lots of other parts to this project I want to put together in one script. Thanks for your help!

Posted

You might be better off using a number of short scripts which are called by your main script. Sort of like using subroutines.

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