NetTalk Central

Author Topic: Update parent field when value entered in child  (Read 17751 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #15 on: March 01, 2012, 04:53:17 AM »
Bruce,

I forgot to add to the code, access:specimen.update().

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Update parent field when value entered in child
« Reply #16 on: March 01, 2012, 05:41:03 AM »
so are you saying you're all sorted now?

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #17 on: March 01, 2012, 07:19:49 AM »
Bruce,

     No, not sorted out yet.  I meant I forgot to add it to the sample code above.  I still have this problem.

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Update parent field when value entered in child
« Reply #18 on: March 01, 2012, 07:29:03 AM »
ok, then - see my earlier note - working from your example I need to know what to do (how to login etc) to see the effect you're looking at/for.

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #19 on: March 01, 2012, 10:18:24 AM »
Bruce,

     Please see reply #14 of this thread, it explains how to log in and the effect I'm looking for.

Thanks,
Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Update parent field when value entered in child
« Reply #20 on: March 01, 2012, 10:33:24 PM »
ahh - missed that.
ok, first a couple of basic errors to sort out.

a) It's not recommended to display primary key component fields on the form as "string" fields. You've got them as auto-number, and "read only" - but it's still a bad thing to have them there as "Strings" or :"Numbers" - Change them to "display" if you want to display them (at least for early development) in the long run hide them away completely. To be fair, while this was a hard "rule" in NT4, it's no longer the case, and these days read-only fields are ok, nevertheless it's considered "poor form".

b) pth:Pathology_complete field, client-side tab, "on focus" - refresh value - tick this off. (It's just wrong.)

>> When complete they are to mark Pathology Complete in the pathology data section.

your data layout seems a little strange. So you have a field in the Pathology table, which is really a short-cut for the user setting the "path complete" setting in the specimen table? I suppose I should ask why they don't just set the spe:path_complete on the UpdateSpecimen table. I mean, you could put the field on the Pathology tab and everything. It seems to me it'd make more sense there. But ok, I'll presume there's some logic in your layout, so....

you have 2 problems;
(we'll ignore the fact that they can in fact change the pathology records after selecting that field.)

a) the specimen record may not have been written to disk at all at that point. If you're doing an insert then the parent record has been created, yes, but is currently blank.

b) the form is still open for UpdateSpecimen, so changing the record on disk would be useless, as it'll shortly be overwritten.

No, in the ValidateUpdate routine, all you can do is

  p_web.SSV('spe:date',today())
  p_web.SSV('Spe:case_number',  p_web.GSV('spe:source') & '-' & p_web.GSV('spe:specimen_id'))
  p_web.SSV('Spe:pathology_complete','Yes')

setting the current session values, and using the existing session values where existing values are required.

Your next issue is refreshing the other fields on the _specimen form_ when the _pathology form_ is completed.
That's a fair bit trickier, so perhaps take on board all the above, then repost your example with the changes etc, so we can take it further.

cheers
Bruce




jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #21 on: March 02, 2012, 08:39:16 AM »
Bruce,

Thanks for taking the time with this.  I really appreciate your input.  Here are my comments:

a.  This is a test app and I have the primary key component fields displayed just for my reference during development.  These will be removed/hidden in the final app.

b.  Yup, just a left over setting I was testing.  I tried a number of different things trying to get the effect I was looking for.  This will be cleaned up.

     I have two (redundant) Path complete fields mainly for convenience at this point.  Two people will be involved in data entry.  An assistant will create the record in specimens.  Then a Pathologist will complete the pathology record, possibly coming back a number of times before deciding the record is complete.  This field should only be set by the pathologist, not the assistant.  
     I like your idea of placing the specimen path complete field on the path form.  I had not thought of this and thus I can remove the path complete field from the pathology file.  The Pathologist can set this field when ready, and I can display it in the specimen browse as well so the assistant does not need to look elsewhere for the  complete status.
     I would like to lock the pathology record when complete, preventing any changes, except perhaps by the Pathologist.  I think I can accomplish this by adding SecWin.  Finally, the other specimen variables can be set as you suggested, upon update validation or upon entering Yes in the specimen path complete variable (I actually have this working in my current version.

Thanks for all your input.

Jeff

« Last Edit: March 02, 2012, 08:44:29 AM by jking »

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #22 on: March 02, 2012, 09:21:41 PM »
Bruce,

     I have attached an updated version of the app, with the same dictionary as before.  I changed the id number fields to display as recommended but just for development.  I have removed all the previous embed code I tried to get the specimen path complete to refresh after the path form was completed. 
     You mentioned getting the fields on the specimen form to refesh after the path form changes was trickier.  Can you provide some direction here?
     Also, this particular copy of the app has developed a problem.  I find login no longer works as expected.  The index page does not update properly nor can I call the main browse.  The login form keeps appearing.  I have noticed this many times before after numerous recompiles and I resolve this by using a backup copy.  However, I feel there is a problem here that needs fixing.  My embed code in the login form has not changed at all.  This is the code that does a lookup into the user file.  Can you take a look at this as well?  As I said I have other versions of this app where the login works as expected. 

Thanks,

Jeff

[attachment deleted by admin]

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #23 on: March 03, 2012, 03:16:40 AM »
Force the webserver procedure to regenerate- typically by changing some setting or other on it.

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Update parent field when value entered in child
« Reply #24 on: March 03, 2012, 04:40:42 AM »
Bruce2,

     Thanks!  That seems to have fixed the login problem.

Jeff