NetTalk Central

Author Topic: How to call a "secondary" form after saving main update form?  (Read 1127 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
How to call a "secondary" form after saving main update form?
« on: October 14, 2024, 12:24:42 PM »
Hello all,

     I'm working on a NT 14.20 app.  I call a NetWebForm procedure to do an insert and a Study_ID field is created and saved.  Upon saving I want to pop up a second form that shows the newly created Study_ID and has a print button.  The print button should call a report that has the new Study_ID and some instructional text.  If the user does not click the print button, they can just close the second form and continue.

     I have tried to adapt the Adding a Report section of the NetTalk Book, 4th edition, but have not been able to get this to work.  Anyone have suggestions on how to do this?

Thank you,

Jeff King

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #1 on: October 14, 2024, 12:58:19 PM »
Hi Jeff,
Why not use the "URL on Save" from the 1st form to go to the 2nd form sending the Study_ID as a parameter?
-----------
Regards
Alberto

rjolda

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #2 on: October 14, 2024, 03:19:47 PM »
Jeff,
In the Form there is a Routine - Post Insert - which I use occasionally to do some secondary work. Maybe call a MemoryForm with the Print button.  If you save the Study_ID in p_web.SSV('Study_Id', Study_ID) then you can add the net talk (<NetWebServerWorker p_web>) in Prototype and Parameters for your report.  Then, in your report, in Init, Enter procedure setup embed or just after that one,  thisStudyID = p_web.GSV('Study_Id').     thisStudyID is a local variable in your Report and it becomes the filter for the report.  You can use the Report part only with maybe the method Alberto suggested.  However, I find that it is easier to make a MemForm for specific things.
Ron

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #3 on: October 14, 2024, 03:59:46 PM »
Hi Alberto,

     Your suggestion is interesting.  The normal process is to open a browse, do an insert and then return to the browse after a save or cancel.  With your suggestion I think the user would be taken from the form to the secondary form and no longer be returned to the browse.  Is this correct?  If so this would not be what the client wants.

Thanks,

Jeff
« Last Edit: October 14, 2024, 04:13:05 PM by jking »

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #4 on: October 14, 2024, 04:34:25 PM »
Hi Ron,

     I have tried your suggestion.  In the Post Insert embed I have:

            NewStudyIDForm(p_web)    !!Call Memory Form

     This does not seem to work as the memory form does not appear when inserting a new record.  Am I calling the memory form correctly?

Thanks,

Jeff

rjolda

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #5 on: October 15, 2024, 03:31:43 PM »
Jeff,
I am not sure of a good way to call the MemForm Procedure now that I look at it.
I would consider putting a Button on the Browse that says "Print Report".  It sounds like each record should have the Print report button so you don;t need to hide/unhide it.  Make It an Action: Other .  For th "On Click" action, use the second line the Procedure:  In there put the NewStudyReport.  No need for a MemForm now that I see what you are trying to do.  Just the button.  Make the NewStudyReport a Report procedure itself.  It is the one that gets called with the Print Button.  The Target Frame is '_blank' ( this opens the PDF report in a new tab). The NewStudyReport procedures has the Prototype/ Parameter (<NetWebServerWorker p_web>).     You just need to make sure that the highlighted record p_web.GSV('Study_Id') is in focus so that you get the correct report.  You can put code in the "Client-Side" tab. 
For my Browse, I actually flag that the report was printed.  so I send the Button click to the server, I have this in the SERVER CODE:
     ! for marking printed...
    JSRV:GUID = p_web.GSV('JSRV:GUID')
    if access:J_SRVREQ.fetch(JSRV:GUID_KEY) = Level:benign
        p_web.SSV('JSRV:reqPRINTED',1) 
        access:J_SRVREQ.Update() 
      JSRV:reqPRINTED = 1     
    end   
And I Refresh browse row DATA after server code runs.
Jeff, I think that this is really all you need.
Yell at me if it isn't going right for you and I can help you.
Ron

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: How to call a "secondary" form after saving main update form?
« Reply #6 on: October 15, 2024, 04:08:36 PM »
Hi Ron,

     After looking at a few other posts here, I came to the same conclusion, use an in-row button on the browse.  I can call a test report from this button now.  This is not as "automatic" as the user wants but it should do.

Thanks!

Jeff