NetTalk Central

Author Topic: Refresh Browse After Report Generation  (Read 7736 times)

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Refresh Browse After Report Generation
« on: May 03, 2021, 10:33:52 AM »
Hi:
There is a way to refresh a browse after a report is generated?

I'm calling the report with a button in another procedure (NetWebPage)

I set the option refresh the whole browse after server code runs in the browsw, but nothing happens.

Something I am missing?

Thanks @ Urayoan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Browse After Report Generation
« Reply #1 on: May 05, 2021, 09:53:17 PM »
Hi Ura,

I'm not sure if I'm following correctly.
You have a button on a NetWebPage that generates a report. When this is done you want to refresh a browse.
But the browse is, um, where? Another tab? on the netWebPage?

there are ways to refresh the browse, but I'm needing more on the context to understand what you are doing.

cheers
Bruce

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #2 on: May 06, 2021, 04:54:23 AM »
Hi Ura,

I'm not sure if I'm following correctly.
You have a button on a NetWebPage that generates a report. When this is done you want to refresh a browse.
But the browse is, um, where? Another tab? on the netWebPage?

there are ways to refresh the browse, but I'm needing more on the context to understand what you are doing.

cheers
Bruce

The browse in inside a WebForm. The reports I'm generating are per records so the print button is inside the browse.  When I click the print button, this call a NetWebPage proc in a new page, that decides what type of report to print, generate and send back the PDF. After the print, the status of the record in the browse is changed to well, printed. I set my filter to not show whats printed in the list and it works, but after generate the report, I need to manually reload the browse via web browser refresh (yikes).

I will make a simple example of what I'm trying to achieve if not clear.
« Last Edit: May 06, 2021, 05:00:10 AM by urayoan »

osquiabro

  • Hero Member
  • *****
  • Posts: 687
    • View Profile
    • Email
Re: Refresh Browse After Report Generation
« Reply #3 on: May 06, 2021, 05:36:41 AM »
check the GotFocus Back routine in your WebForm, I don't know if it works when you call a page as a new page, for me it works as a popup and closes a window, like this

p_web.PushEvent('parentupdated')     
do refresh::BrowseCustomerServices

the browse is inside the webform

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #4 on: May 06, 2021, 08:44:48 AM »
check the GotFocus Back routine in your WebForm, I don't know if it works when you call a page as a new page, for me it works as a popup and closes a window, like this

p_web.PushEvent('parentupdated')     
do refresh::BrowseCustomerServices

the browse is inside the webform

Thanks man. Will try and check if it works

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #5 on: May 06, 2021, 10:40:14 AM »
check the GotFocus Back routine in your WebForm, I don't know if it works when you call a page as a new page, for me it works as a popup and closes a window, like this

p_web.PushEvent('parentupdated')     
do refresh::BrowseCustomerServices

the browse is inside the webform

Question related to this, the button is called from the browse and not from the form. Any ideas how to call it from the browse (the getfocusback function)

This is the code I call from he buttton in the row of the browse. The bold text is what I think should refresh the browse based on what you told me and what I understand

PrintAllLabels       PROCEDURE  (NetWebServerWorker p_web)
LocFileName          CSTRING(256)                          !
LocPDFName           CSTRING(256)                          !
LocTimeStamp         LONG                                  !
LoopVar              LONG                                  !
! Start of "Data Section"
! [Priority 50]

oHH           &tagHTMLHelp
! [Priority 2600]

    omit('***',WE::CantCloseNowSetHereDone=1)  !Getting Nested omit compile error, then uncheck the "Check for duplicate CantCloseNowSetHere variable declaration" in the WinEvent local template
WE::CantCloseNowSetHereDone equate(1)
WE::CantCloseNowSetHere     long
    !***
! [Priority 6100]

loc:x          Long
packet         StringTheory
loc:options    StringTheory ! options for jQuery calls
! [Priority 8500]

! End of "Data Section"
! Start of "Local Data After Object Declarations"
! [Priority 5000]

! End of "Local Data After Object Declarations"

  CODE
  GlobalErrors.SetProcedureName('PrintAllLabels')
  p_web.Trace('PrintAllLabels START')
! Start of "Procedure Setup"
! [Priority 2500]

  p_web.SetValue('_parentPage','PrintAllLabels')
  If p_web.GetSessionLoggedIn() = 0
    If p_web.site.LoginPage = ''
      p_web.SendError (401,'Unauthorized', 'A login is required to view this page', true , true)
    ElsIf p_web.site.LoginPageIsControl
      p_web.MakePage(p_web.site.LoginPage)
    else
      p_web._SendFile(p_web.site.LoginPage)
    End
    Return
  End
! [Priority 7500]

! End of "Procedure Setup"
! Start of "Processed Code"
! [Priority 500]

  if p_web.sessionId = '' then p_web.NewSession().
  ! Start of "Before Header"
  ! [Priority 5000]
 
  ! End of "Before Header"
  do Header
! [Priority 1200]

! [Priority 4000]
    IF p_web.GetValue('RRH:RequestNumber') > 0

      LocTimeStamp = FORMAT(CLOCK(),@T5)

      LocPDFName =  '$$$' & clip(p_web.SessionID) & LocTimeStamp & '.pdf'

      LocFileName = 'labels\'  & LocPDFName

      WindowProcessSARAWebRequest(p_web.GetValue('RRH:RequestNumber'),LocPDFName)

      !DO RefreshBrowse

    END!IF
  do Footer
! [Priority 8500]

  do SendPacket
! [Priority 9500]

! End of "Processed Code"
  p_web.Trace('PrintAllLabels END')
  GlobalErrors.SetProcedureName()
  Return

! Start of "Procedure Routines"
! [Priority 4000]
RefreshBrowse   ROUTINE
DATA
loc:parent                 string(252)
CODE
    p_web.PushEvent('gainfocus')
    p_web.SetValue('_parentProc_',p_web.SetParent(loc:parent,'WindowUpdateOrder'))
    p_web.SetValue('BrowseNewOrders:parentIs','Form')
    BrowseNewOrders(p_web)

EXIT



SendPacket  Routine
! Start of "Start of SendPacket Routine"
! [Priority 5000]

! End of "Start of SendPacket Routine"
  p_web.ParseHTML(packet,1,0,Net:NoHeader)
  packet.SetValue('')
! Start of "End of SendPacket Routine"
! [Priority 5000]

! End of "End of SendPacket Routine"
Header  Routine
! Start of "Start of Header Routine"
! [Priority 5000]

! End of "Start of Header Routine"
  ! Start of "W3 Header Override"
  ! [Priority 5000]
 
  ! End of "W3 Header Override"
  p_web.ReplyContentType = p_web.GetContentType('.pdf')
  p_web.ReplyContentFixed = 1
  packet.setvalue('')
  ! Start of "End of Header Routine"
  ! [Priority 5000]
 
  ! End of "End of Header Routine"

Footer  Routine
! Start of "Start of Footer Routine"
! [Priority 4000]
    p_web.ForceNoCache = 1
    p_web.HeaderDetails.ContentDisposition = 'attachment; filename="'&CLIP(p_web.SessionID) & CLIP(LocTimeStamp) & '.pdf'&'"'
    p_web.ReplyContentType = 'application/octet-stream'
    p_web.ReplyContentFixed = true
    p_web.SetHeader200()
! End of "Start of Footer Routine"
  p_web._Sendfile(clip(p_web.site.WebFolderPath) & '\' & LocFileName)
! Start of "End of Footer Routine"
! [Priority 5000]
    DO RefreshBrowse
! End of "End of Footer Routine"
! [Priority 8500]

! End of "Procedure Routines"
! Start of "Local Procedures"
! [Priority 5000]

! End of "Local Procedures"

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Browse After Report Generation
« Reply #6 on: May 09, 2021, 10:56:47 PM »
Hi Ura,

So I think - if I change that you wrote - it makes sense. You said;

>> When I click the print button, this call a NetWebPage proc *in a new page*, that decides what type of report to print, generate and send back the PDF. After the print, the status of the record in the browse is changed to well, printed. I set my filter to not show whats printed in the list and it works, but after generate the report, I need to manually reload the browse via web browser refresh (yikes).

I'm thinking that you mean you call the NetWebPage proc in a new _tab_? Am I right? So you now have 2 _tabs_ in play, one with the browse, one with the netWebPage, and you want the _browse_ tab to update when the other tab has finished on the report?

Cheers
Bruce


urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #7 on: May 10, 2021, 06:40:21 AM »
I'm thinking that you mean you call the NetWebPage proc in a new _tab_? Am I right? So you now have 2 _tabs_ in play, one with the browse, one with the netWebPage, and you want the _browse_ tab to update when the other tab has finished on the report?

Cheers
Bruce

Yes Bruce

Thanks

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Browse After Report Generation
« Reply #8 on: May 10, 2021, 10:46:28 PM »
>> I'm thinking that you mean you call the NetWebPage proc in a new _tab_? Am I right? So you now have 2 _tabs_ in play, one with the browse, one with the netWebPage, and you want the _browse_ tab to update when the other tab has finished on the report?

Probably the only way to do this is using the WebSocket support.
which NetTalk build are you using?

Cheers
Bruce


urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #9 on: May 11, 2021, 03:48:46 AM »
Probably the only way to do this is using the WebSocket support.
which NetTalk build are you using?

Cheers
Bruce

NetTalk 12.13

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #10 on: May 17, 2021, 04:06:49 AM »
Hi Bruce
  Anything in mind with this?

Thanks

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Refresh Browse After Report Generation
« Reply #11 on: May 18, 2021, 12:35:18 AM »
not yet, I'm working on making it easy for you.

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Refresh Browse After Report Generation
« Reply #12 on: May 18, 2021, 09:45:03 AM »
not yet, I'm working on making it easy for you.

Thanks Bruce, that would be awesome for all