November 18, 20196 yr 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)
November 18, 20196 yr 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 ; 0 )
November 18, 20196 yr 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 November 18, 20196 yr by comment
November 18, 20196 yr 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.
November 19, 20196 yr 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.
November 19, 20196 yr Author 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,.
Create an account or sign in to comment