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

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

Recommended Posts

Posted

Hi all

I am trying to write a script that will find a specific date depending on the current month. If it is October, November or December I want the find in the script to the 1st October and the current year. If it is the rest of the year I want it to find 1st October and the previous year.

My script is currently

Enter Find Mode

If(month(Today) >= 10

Set Field(Date Of Leaving,TextToDate("<1/10/" &Year(Today))

Else

Set Field(Date Of Leaving,TextToDate("<1/10/" & Year(Today) - 1)

End If

Perform Find

What am I doing wrong???

Please Help

Thanks

Posted

I think you're missing some brackets.

After your "else" try:

Set Field(Date Of Leaving,TextToDate("<1/10/" & (Year(Today) - 1))

note the extra brackets around (Year(Today) - 1)

Posted

... and use Status(CurrentDate) not the TODAY function.

I just noticed the TextToDate() function in there. TextToDate will break if the solution is used on a machine set to a different date format (eg, Australian instead of US). Use Date() instead.

So, putting it all together...

Insert Calculated Result [Date Of Leaving, "<" & DateToText(Date(1, 10, (Year(Status(CurrentDate)) - 1))]

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