Hello

I wanted help in trying to implement the following limitation in our system.

"Each student can only have € 20 in their account"

So if the student has 0 € in his account he can charge with 20 € if he has 10 € he can charge the rest if he has 20 € he can not carry the load until he has to spend the balance.

I may not fully understand your goal here, but assuming you have a field to store the students' account balance such as Students::accountBal, start by assigning a validation requirement to it under Manage... Database so that either the Validation is in Range from 0 to 20, or a calculation of ≤ 20.

Then for better user experience you can have the user enter the amount they intend to "charge up" their account into a global field (such Globals::g_accountTopUp) and then run script to compare the current balance with the top up amount. In other words, you'd retrieve the current account balance; if it's less than 20, add the "top up" to it; if the sum is over 20, guide the user accordingly.

You could also show the eligible amount to add (charge or top up) before making any effort to enter amounts. So on the student's record it would show the current balance and a calculation of how much can be added (charged or topped up). The user would see, for example, that a student has a balance of 7.5 and is eligible to add up to 12.5. (If that matches your intended policy/business logic.

If all this is wrong, then I guess I don't quite understand.