NetTalk Central
		NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd 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
- 
				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.
- 
				>> 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
 
- 
				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.
- 
				 CASE p_web.GSV('CompanyIDX')
 OF 'TRDZ'
 p_web._trace('TripID ' &  p_web.GetSessionValue('TRI:TripID'))
 PrintTripSheet(p_web)
 ELSE
 PrintTripSheet(p_web)
 END
- 
				Baie dankie. Dit werk  :)