MONTH Difference Calculation

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

MONTH Difference Calculation

Post by NBDAB »

Thanks in advance - We have two questions?

Q1) We would like to calculate a Contracts end date based on a fixed duration of (6,12 or 24) months

We have three three attribues. StartDate, EndDate (Both are MM/DD/YYYY, however EndDate is Calculated) and Contract_Duration (Number,6,12,24)

Q2) Months_Differece

based on the same attributes we wish to Calculate the Months Difference between the Start and End to use for other calculations

Thank you
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Look through the functions -- specifically MONTH_ADD
Tom - V8.8 build 3137 - MySql / PostGres
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

and these 2 functions: MONTH_DIFFERENCE MONTH_DIFFERENCE2
Tom - V8.8 build 3137 - MySql / PostGres
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

thanks

Post by NBDAB »

Thanks will try nue
Regards, Lars
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

tried

Post by NBDAB »

hej, we tried this

RULE:

Customer.ContractEndDate=MONTH_ADD(Customer.ContractStartDate+Customer.ContractDurationMonths)

With ERROR:

com.bas.shared.ruleparser.ParseException Unsupported function MONTH_ADD

The EndDate attribute is Calc, and same format as StartDate
The ContractDurationMonths is just a Number attribute with four choices 6,12,24,36

Hrm.... any ideas?
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

Post by NBDAB »

also, Version 4.7 Build (1246), mysql
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

No + needed. Please look at the syntax in user guide.
Tom - V8.8 build 3137 - MySql / PostGres
NBDAB
Posts: 39
Joined: Sat Oct 10, 2009 4:42 pm

thanks

Post by NBDAB »

after a kafe break we found error

Customer.ContractEndDate=MONTH_ADD(Customer.ContractStartDate,Customer.ContractDurationMonths)

PLUS

The Attribute formating for the dates changed to

dd MMMM yyyy

Thanks, Lars
yahya
Posts: 77
Joined: Sat Jul 16, 2011 6:00 am
Location: South Africa
Contact:

Re: MONTH Difference Calculation

Post by yahya »

If I want to create a new contract that starts from the beginning of a new financial year, I try apply the below:

Customer.ContractStartDate=MONTH_ADD(MONTH(Customer.FinancialYearEndDate)+FIRST_DAY_OF_NEXT_MONTH)

I get an error to say that 'FIRST_DAY_OF_NEXT_MONTH' does not exist, whether it is a business object rule or in a process action.
AwareIM Developer edition. Version 8.5 (Build 2827) running on Windows Server 2012 R2 Standard
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: MONTH Difference Calculation

Post by customaware »

yahya wrote:If I want to create a new contract that starts from the beginning of a new financial year, I try apply the below:

Customer.ContractStartDate=MONTH_ADD(MONTH(Customer.FinancialYearEndDate)+FIRST_DAY_OF_NEXT_MONTH)

I get an error to say that 'FIRST_DAY_OF_NEXT_MONTH' does not exist, whether it is a business object rule or in a process action.
Would this not work?

Customer.ContractStartDate=DATE_ADD(Customer.FinancialYearEndDate,1)

If FinancialYearEndDate = June 30 2020
The ContractStartDate = July 1 2020
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: MONTH Difference Calculation

Post by PointsWell »

yahya wrote:If I want to create a new contract that starts from the beginning of a new financial year, I try apply the below:

Customer.ContractStartDate=MONTH_ADD(MONTH(Customer.FinancialYearEndDate)+FIRST_DAY_OF_NEXT_MONTH)

I get an error to say that 'FIRST_DAY_OF_NEXT_MONTH' does not exist, whether it is a business object rule or in a process action.
FIRST_DAY_OF_NEXT_MONTH requires parameters.

From manual IF FIRST_DAY_OF_PREV_MONTH (Account.OpeningDate=01/09/2004) Then ...
yahya
Posts: 77
Joined: Sat Jul 16, 2011 6:00 am
Location: South Africa
Contact:

Re: MONTH Difference Calculation

Post by yahya »

eagles9999 wrote: Would this not work?

Customer.ContractStartDate=DATE_ADD(Customer.FinancialYearEndDate,1)

If FinancialYearEndDate = June 30 2020
The ContractStartDate = July 1 2020
Thanks Mark,
That would work, my next dilemma is how do I continue when 2020 is over and we in 2021, I could possibly run a scheduled process that updates the FinancialYearEndDate.
AwareIM Developer edition. Version 8.5 (Build 2827) running on Windows Server 2012 R2 Standard
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: MONTH Difference Calculation

Post by customaware »

Hi Yahya,

Please PM me or send me an email to [email protected] or [email protected].
Would need to understand a bit more context of what you are wanting to do.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Post Reply