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

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

Recommended Posts

Posted

hi

I have a field order date

I would like to make a script that omit the record if the order date is from the same month and year as the current timeStamp

I will trigger the script on the last day of the month.

My format in order date is 26/01/2005

it should not be 30 days back, but all the record from the same month

How do i make the script ?

Posted

The calculation you'll need will compare the month and year of today's date with the month and year of the order's date. Here's a boolean calculation that can be used in a number field so 1 means it's in the month and 0 if not. OrderDate is the field of type Date with the Order Date in it.

Let (

[

TodaysDate = Get ( CurrentDate ) ;

TodaysMonth = Month ( TodaysDate ) ;

TodaysYear = Year ( TodaysDate ) ;

OrdersMonth = Month ( OrderDate ) ;

OrdersYear = Year ( OrderDate )

] ;

( TodaysMonth = OrdersMonth ) and ( TodaysYear = OrdersYear )

)

Posted

Hi

you can make a script like this:

Enter Find Mode[omit records]

Set field [OrderDate;Date ( Month(Get ( CurrentDate )) ; 1 ; Year(Get ( CurrentDate )) ) & ".." & Date ( Month(Get ( CurrentDate ) )+ 1 ; 1 ; Year(Get ( CurrentDate )) ) - 1]

Perform Find

Posted

Hi

you can make a script like this:

Enter Find Mode[omit records]

Set field [OrderDate;Date ( Month(Get ( CurrentDate )) ; 1 ; Year(Get ( CurrentDate )) ) & ".." & Date ( Month(Get ( CurrentDate ) )+ 1 ; 1 ; Year(Get ( CurrentDate )) ) - 1]

Perform Find

Thanks, could someone please explain the what the script does ?

Posted

Thanks, could someone please explain the what the script does ?

What it does is to create a range for the find. In this case, it is creating 12/01/2005..12/31/2005

I'll presume that you know what Find is, so the basic calculation is saying set the field "OrderDate" with the range when in Find Mode.

The first part of the calculation is saying to use the current's month and Year, and the "1" as the day, and the second part is saying to use the current month and year and the 1 again, but to add "+1" to the current month (equalling 13), and from that then, subtract "-1", which will return the end of the 12th month.

HTH

Lee

Posted

hi

The script is perfect, thanks a lot raybaudi

I was trying to learn how it works, Thank you for the explanation Lee Smith.

how should it look if you want to trigger it the 1. of the next month instead?

Posted

how should it look if you want to trigger it the 1. of the next month instead?

Enter Find Mode[omit records]

Set field [OrderDate;Date ( Month(Get ( CurrentDate ))-1 ; 1 ; Year(Get ( CurrentDate )) ) & ".." & Date ( Month(Get ( CurrentDate ) ) ; 1 ; Year(Get ( CurrentDate )) ) - 1]

Perform Find

and you can trigger it in whatever day of the next month (not only the first).

If you fire this script now, you will omitt all the records of November

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