NetTalk Central

Author Topic: Selecting report to print from button on browse row  (Read 5275 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Selecting report to print from button on browse row
« on: August 15, 2013, 12:44:10 AM »
I have a browse with a button action is other. On click I call a procedure PrintTripSheet.
This works fine.
What I want to do to is call a procedure based on a sessionvalue for the company
So when the user logs in I read a table and save a sessionvariable p_web.SSV('CompanyIDX',COY:CompanyIndex)

When the browse button is pressed  i would like to do something like
CASE p_web.GSV('CompanyIDX')
OF 'KIMX'
  PrintTripSheetKIMX
OF 'SPDL'
  PrintTripSheetSPDL
ELSE
  PrintTripSheet
END 

Any advice appreciated
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Selecting report to print from button on browse row
« Reply #1 on: August 15, 2013, 01:05:05 AM »
Doing some testing I have found a possible method
I can  have a bunch of buttons each one running a different print procedure where I  put a condition like p_web.GSV('CompanyIDX') = 'KIMX' in the Column Properties Column Condition field. This would work fine when I have 2 or three reports but will soon get unwieldy if I have 7 or more reports.
 What would be nice would be to call a source procedure from the browse which would then do the case logic and call the relevant print procedure.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11298
    • View Profile
Re: Selecting report to print from button on browse row
« Reply #2 on: August 15, 2013, 01:21:14 AM »
>> What would be nice would be to call a source procedure from the browse which would then do the case logic and call the relevant print procedure.

That's exactly how you do it, except you set the button to call a NetWebPage (not a source). the page then contains a case statement. So, in your example,

>> On click I call a procedure PrintTripSheet

change this so ... On click I call a procedure PrintSelector (where PrintSelector is a netWebPage)

add the case statement into the PrintSelector.

Cheers
Bruce

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Selecting report to print from button on browse row
« Reply #3 on: August 19, 2013, 12:44:16 AM »
HI Bruce
Tried this.
In the NetwebPage I have this case statement (abbreviated)
 CASE p_web.GSV('CompanyIDX')
 OF 'TRDZ'
  p_web._trace('TripID ' &  p_web.GetSessionValue('TRI:TripID'))
    PrintTripSheet
 ELSE

    PrintTripSheet
 END
At This point the value of the TripID is correct i.e. has the value of the record i want to print

In the PrintTripSheet procedure in the windows init I have 
If Not p_Web &= NULL
  TripID = p_web.GetSessionValue('TRI:TripID')
End
If I call the PrintTripSheet directly from the browse the value is correct, and the report is created.
If I call the NetWebPage from the browse and PrintTripSheet from the NetwebPage then this value is blank and I get a No records message even though the value of TripId is correct within the netwebpage.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11298
    • View Profile
Re: Selecting report to print from button on browse row
« Reply #4 on: August 19, 2013, 09:02:49 PM »
CASE p_web.GSV('CompanyIDX')
 OF 'TRDZ'
  p_web._trace('TripID ' &  p_web.GetSessionValue('TRI:TripID'))
    PrintTripSheet(p_web)
 ELSE
    PrintTripSheet(p_web)
 END

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Selecting report to print from button on browse row
« Reply #5 on: August 19, 2013, 09:13:11 PM »
Baie dankie. Dit werk  :)
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186