Hi Marcos,
>> I think that I didn’t understood how NT “remembers” the file settings that a parent pass to a child procedure (handle).
It would be a bad idea to think of this as a parent / child type relationship. Think of it more as a browse, followed by a form, followed by a form. In "concept" the 3 procedures are unrelated.
Now a browse and the first form "fit together" because they are both set on the same Table, with the same "Unique key". So the key field (of the unique key) is included when calling the form. The form can then load that record.
When you go from a Form to another form, then all the fields on Form 1 are in the Value Queue when Form 2 is first called. Not the session queue (because values ar not automatically moved to the session queue) just the value queue.
In your example you have loc:newrec, and this will thus be in the Value queue. The first thing you want to do in the second form is then to store this in the Session queue.
p_web.StoreValue('loc:newrec')
You can safely do this right at the top of the (second) form procedure.
Then in the preupdate routine you can use p_web.GetSessionValue('loc:newrec')
>> I think that I didn’t understood how NT “remembers” the file settings that a parent pass to a child procedure (handle).
There are really only 2 things in play here. The "Value queue" - which are all the parameters coming in via the actual request (you can see these in the log) and the Session Queue - which are "global" to the session itself. Items are moved from the Value queue to the Session Queue using StoreValue. And then in your code elsewhere you pretty much always want to be using the Session Value.
If you want to load table records, then you can move the fields from the table to the session queue using
p_web.FileToSessionQueue(customers)
and you can move from the session queue to the File record using
p_web.SessionQueueToFile(customers)
When manually reading or writing records from a table you should always OPEN and CLOSE the table yourself. Do not assume the tables are Open (they are usually not open.) For example;
Access:Customers.Open()
Access:Customers.UseFile()
Cus:Id = p_web.GSV('loc:UserId')
Access:Customers.Fetch(cus:key)
p_web.FileToSessionQueue(Customers)
p_web.SetSessionValue('ThisCustomer',cus:id)
Access:Customer.Close()
Cheers
Bruce