Organizer Advantage is powerful yet easy to use database manager for Windows.
Advantage Designer lets you modify our solutions or easily create new ones.
Take control of your data with our simple or buinsess database software solutions.


 |  Organizer Advantage HowTo/Help  |  Designer HowTo/Help  | 


easy-to-use database manager and database designer for Windows

Calculation Definitions, Exception Errors

In some situations arguments used in functions, with empty or wrong value, could trigger exception errors. You have to avoid exception errors, if the error is displayed the record will not be saved.

Calculating a number of years between dates:
The number of years passed between the DATE_JOINED and the CURRENT_DATE could be calculated by the function:
DATEDIFF(year, DATE_JOINED, CURRENT_DATE)
If the DATE_JOINED value is empty the above function will display exception error message. The above function should be defined in the following way:
DATEDIFF(day, COALESCE(DATE_JOINED, CURRENT_DATE), CURRENT_DATE)

Calculating a number of days between dates:
RENEW_IN_DAYS calculates the number of days left for the next fee payment. The payment is on yearly bases (365 days). The calculation could be defined as:
365-DATEDIFF(day, LAST_PAYMENT, CURRENT_DATE)
In the case of empty value for the LAST_PAYMENT the calculation will display exception error message. The above function should be defined in the following way:
365-DATEDIFF(day, COALESCE(LAST_PAYMENT, CURRENT_DATE-365), CURRENT_DATE)

Defining divisions:
BALANCE_LEFT_PERCENT calculates the percentage of money left in the project cost manager. The calculation could be defined as:
(PROJECT_BUDGET - PROJECT_CURRENT_COST)/PROJECT_BUDGET*100
If the PROJECT_BUDGET value is empty or zero there will be a division by zero. The above procedure should be defines as:
(PROJECT_BUDGET - PROJECT_CURRENT_COST)/NULLIF(PROJECT_BUDGET,0)*100

 

Copyright © 2024 · All Rights Reserved · PrimaSoft PC