Update DB fields but not able to see them update on the form

Dear all,

I’ve an invoice form and I created a PHP button to copy customer address to shipping address on other tab form section.

$update_db_address = “UPDATE invoices
SET ShipName = $glb_ShipName ,
ShipAddress = $glb_ShipAddress,
ShipCity = $glb_ShipCity,
ShipRegion = $glb_ShipRegion,
ShipPostalCode = $glb_ShipPostalCode,
ShipCountry = $glb_ShipCountry
WHERE InvoiceID = {InvoiceID}”;
sc_exec_sql($update_db_address);

On DB it works properly and if I go to check it I found the shipping fields adresses populated correctly.

Just to be sure I also used the standard button UPDATE and it seems all right.

If I later go/navigate trough other invoices and the come back to the first invoice updated above I do not see the shipping field populated but all still empty.
What I’m missing ?
Have I to do a sort of refresh after the sc_exec_sql command in order to see values ?
Thanks
Giovanni

Yes, you have to do a refresh. Reason is that if you have done a select on the database and work on those fields, and you dynamically create a database update statement and shoot it to the db, there’s no way the application can know of this. The data needs to be resynced.

OK Thanks,

which is the command I have to use ?
On…what events ?

That will be a litttle experimenting I’m affraid. What you could try is to do a sc_redir to the same application. It will reload on init.