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

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

Recommended Posts

Posted

 

I am working with a water billing system.

so I have a field for a reading of a water consumption so this is the process flow,this is also a field in a portal (date billed  with due date and previous-present reading=consumption then consumption=amount due and there is a penalty field, when the consumer did'nt pay or paid after the due date then the calculation execute.)

after the 1st week that i have developed the aplication the calculation and the field is working fine, but when i try to enter new bill recently ,i have noticed that it is not working properly,like its always calculating even the result is false.

 

please help or please give other suggestion with this calculation.

Case ( IsEmpty ( DatePaid ) or DatePaid>Due Date;AmountDue*.05;0;Due_Date<Get (CurrentDate);AmountDue*.05;0)

Posted

Here is your case statement on a line-by-line basis

Case ( 
IsEmpty ( DatePaid ) or DatePaid>Due Date ; AmountDue*.05 ; 
0 ; Due_Date<Get (CurrentDate) ; 
AmountDue*.05 ; 0 
)

All I have done is put in some returns to separate the individual cases

Notice that case #2 starts with "0". This is not a comparative but will always be true and will yield either 0 or 1 based on Due_Date<Get(CurrentDate)

Should your statement actually be...

Case ( 
IsEmpty ( DatePaid ) or DatePaid>Due Date ; AmountDue*.05 ; 
Due_Date<Get (CurrentDate) ; AmountDue*.05 ; 

)

 

  • Like 1
Posted (edited)
7 hours ago, Mark Pastoril said:

there is a penalty field, when the consumer did'nt pay or paid after the due date

Based on this description, I would expect the penalty to be calculated as something like:

If (
Get (CurrentDate) > Due Date and not DatePaid
or
DatePaid > Due Date
;
AmountDue *.05
)

However, this still has the flaw of hard-coding the penalty rate into the calculation formula. Ideally, the rate would be auto-entered into another field and referenced from there, so that you can change it without affecting previous records.

Note that the calculation must be unstored because it relies on current date.

 

22 minutes ago, IdealData said:

case #2 starts with "0". This is not a comparative but will always be true

A test of 0 will always be false, not true.
OTOH, the last test, AmountDue*.05, will always be true (unless the amount is 0).

 

Edited by comment
  • Like 1
Posted

Quite right comment.

For the OPs benefit I was showing how to write the code in a simplified form which is easier to read and therefore debug.

  • Like 1
Posted
1 hour ago, Mark Pastoril said:

it's working either way.

Is it really? Compare the results in these cases:

1. Customer paid before due date. Due date has passed.

2. Customer has not paid. Due date has not yet passed.

 

Posted
14 hours ago, comment said:

Based on this description, I would expect the penalty to be calculated as something like:


If (
Get (CurrentDate) > Due Date and not DatePaid
or
DatePaid > Due Date
;
AmountDue *.05
)

 

 

Tried this code today sir/madam and it really work, thanks a lot,.

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