NetTalk Central

Author Topic: Going from a Browse to a form on another Table (Example 23)  (Read 6770 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Background:

Up to build 5.04 it was possible to set the Unique key of a browse to be from a table other then the browse table. This was done in Example 23, "Browse To another Form" and was intended for use when the Browse and Form were working on different tables.

Recent reports though have indicated that this technique no longer works, and causes a GPF in the server when the form is opened. Investigation has shown that this is indeed the case, and it's caused specifically by the browse key not being from the browse table.

Change:

As from 5.30 it will no longer be allowed for the key to not belong to the table. Accordingly a template Error will be generated for any browse that has this mismatch.

If you do wish to "prime" a form from a parent-table record (in other words you are coming to a form from the browse of a related table) then use the new setting on the ADVANCED tab of the form called Prime Key From Parent

If you wish to prime the form record by hand, then the following code should be done in the INITFORM routine in the form;

Code: [Select]

for each key field of the form's unique key
  p_web.SetValue('FieldName','FieldValue')
end


At this point, if you did come from a browse, then the browse unique key fields are already in the value queue. So for example;
Code: [Select]

p_web.SetValue('Mor:Id',p_web.GetValue('Cus:Id'))

is what the template generates in example 23.