NetTalk Central

Author Topic: Parent browse to parent update to child update - automatically priming PKID  (Read 2666 times)

mriffey

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • Email
Been using NTWS for over a decade, but almost always for API stuff, so I can never seem to remember the basics of the UI side of things.

I have a browse for customers. The customer update form has browses for child tables. When I insert a child, I expect the parent key to be set properly in the child form, but it isnt. In fact, the GV or GSV values arent correct (they're "stale") so I cant use those.

Example 23 looks like the closest fit, but it isnt really the same thing. Ex 23 uses the advanced tab's "Prime key from parent table" feature, but that doesnt seem to work when going from browse to form to form.

Even when I use "Prime Key from parent table" and have it set to the proper parent table, the value that gets set for the child's FK (parent) value is stale unless i go into the parent update form twice.

Here's a (hopefully) more descriptive version of what I am seeing:

If I browse to customer 1, then open the customer update form for customer 1, then close the update form, then browse to customer 2, then open customer update form for customer 2, then open the update form for customerchild as an insert - customer ID 1 is on the customerchild form. The parent child relationship is defined in the DCT.

If I browse to customer 1, browse to customer 2, open customer update form for customer 2, close the update form, then reopen the customer update form for customer 2, then open the customerchild form for insert, THEN customer ID 2 is on the customerchild form. Obviously, this is not correct, nor is it something youd expect a customer to do.

I fixed it by creating a uniquely named session variable when the parent form opens (set to the parent PKID). That SV gets used in the initform routine of the form procedure to prime the child's PK value (the parent's PKID).

Because of all the fun I had with this, Im wondering if there's a better way to solve the parent browse-parent-update-child-update scenario.

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
How do you have priming setup under the form(s) priming tab?

"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Hi Mark,

The setup sounds a bit specific, so perhaps the easiest thing to do is just wizard up an example of the effect.
From there I can see what you are doing (what your dict relations look like and so on) and advise as to the best approach.

cheers
Bruce

mriffey

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • Email
How do you have priming setup under the form(s) priming tab?

Ive tried the tableprefix:field. Ive tried the GetValue(). Ive tried the GSV(). Ive probably tried a few other things that I no longer remember:) None of them have escaped the stale issue, or theyre empty.