Refresh

Q:
I have a PurchaseOrders table that looks like this:

poid (pk, autoinc)
posuppid (references suppliers.suppid)
potoal (currency)

Dragging that table to a form section gives me the fields, now I don’t want the user to capture posuppid as this is already known so I want to fill this with a valid supplier id, say ‘2’.
The first approach I tried was to leave the posuppid field on the form and set it like this:

Code:
loSec = Lianja.get("Purchase_Orders.section1")          
        loSec.add()

        lfFld = Lianja.get("Purchase_Orders.section1.field5")
        lfFld.value = 2

All looks ok onscreen until I save, then posuppid is set to 0 and the record is saved without the value being set.
So my question is – what is the best way to update a field like this, should I maybe be setting it directly on the table and not on-screen,
A:
UI controls are bound to a data source. Changing the data source and refreshing the control it is bound to should be done.
Programmatically updating the UI control does not update the data source.

Code:
replace purchase_orders.posuppid with 2
Lianja.getElementByID("purchase_orders.section1.fi eld5").refresh()

You have to select the correct cursor first.
If you select a cursor save the active one first and restore it afterwards. See SELECT and SELECT()



Advertisements

Refresh

Q:
As I try to placing field from another table into a grid section I get an error message “You cannot drop this column onto this section”. Is it possible to construct a grid from more tables? For example: from related code tables.
A:
If you want to display fields from more than one table use a “local” virtual table.



Refresh

Q:
How do I refresh a page/section when I navigate to that page? Been trying with init/ready delegate
A:
Use the activate delegate.


The refresh delegate is called when data is refreshed into the UI. This can occur as you navigate data or when you rollback changes before they are committed by clicking undo/cancel. If you have no related sections e.g a map or chart or report that depends on data in another UI section you can update it from the refresh method.