Save Record Problem on Grid once have field value calculation

Hi all,

I have encountered a record SAVE problem on Editable Grid / Editable Grid View etc.
For “Add New / Update” record, if there are having some fields for calculation are required, such as qty x price = amount etc.

By using “onChange” Ajax Event together with “PHP Methods” setup for calculation without any problem. But afterward , click the ‘:heavy_check_mark:’ button for Record Save without any action.

Does having similar experience ? How to resolve ? Is it a bug or restriction ?

Please comment.

Looking forward to hearing from yours soon. Thanks a lot.

rdgs,
Chester

Instead of using temporary field in your Grid, create those in your database and use them to hold the qty or other information needed. That way the save button will be able to save all the information, even if you don’t really need all of them

Hi jlboutin,

Thanks you very much for your reply, I am not fully understand your suggestion. The above just a sample to mention the problem. Let say in a real case about a Master-Detail application , an Invoice function, the master table is to contain “Invoice No, Customer…etc.”, link to the detail record table would be the Invoice Item ( such as Item No, description, qty, unit price & amount etc. will be defined in Invoice Item table) Normally, user would select the Invoice item, then input the “Invoice Qty”, program should auto calculate the “Amount” = “Qty” x “Price”

As of your suggestion , how to do ?

Looking forward to hearing from you soon. Thanks.

Chester

This is a work around and I do understand that you don’t need the Amount field in your DB

But If you do create an Amount field in your DB, you will be able to do your calculation exactly the same way you use the temporary field. When you press save all the field will be save without problem, including the Amount field that you do not need.

Hi jIboutin,

I need the Amount field in DB actually. Just a curious, by your experience, does the Grid cannot be SAVED if a field being assigned by a calculated VALUE ?

Actually , I mentioned problem should very popular in general application, it is strange without similar question in this forum.

Looking forward to hearing from you soon. Thanks.

Chester

Problem resolved, it is very strange, if the PHP Method [ a calculation formula ] to be executed under the “onChange” Ajax Event, it will cause the Grid Insert Button ‘:heavy_check_mark:’ failure. But executed under the “onBlur” Ajax Event , the Grid Insert Button without PROBLEM.

I had a similar problem in the past and I fix it by creating the field in the DB. Since Scriptcase is not always consistant, I try to find work around and I don’t ask too many question.

The problem you have with onChange may be normal, let’s say you need to type the number 50, normally the onChange Event would be call after the 5 and after the 0 because the value of the field change 2 times, first 5 and then 50, but onBlur will only be call one time after you move away

Thanks for sharing your experience. Definitely agree SC is not always consistant. After update to ver. 9.6, I found a New Problem. When Grid create together with the Form, the CSS setting in Form will malfunction, no matter how to changes , it doesn’t work.
To standalone create the Form would everything OK, then link with the Grid again.
Those problem seems didn’t happen in the previous version.