NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Neil Porter on June 10, 2013, 11:49:04 AM
-
I have a NetWebFrom that depending quite a lot of different conditions needs to call one of many print routines.
The end user needs to see just one print button.
Originally I had lots of print buttons, and hide all but the relevant one using the standard hide condition on the button. The problem is, that these conditions have become so complex, that I've actually run out of room to type in the condition (or at least it's getting truncated when generated)
I decided that it would be easier (Maybe??) to have a single print button, that calls a NetWebSource procedure that has all of my conditional logic in it, which in turn calls the relevant print routine. It just about works, by embedding my code in the "Before Div Header" and then returning.
The only problem I have, is if I get an alert message from one of my reports saying nothing to print, then that message gets displayed as a bit of source code (or similar) in the browser window.
Is there a better way of doing this?
Regards,
Neil Porter
C8.9661 NT 6.51
-
Hi Neil,
Have you tried putting all your logic on the server side when a user clicks the button?
Cheers,
Kevin
-
Good idea Kevin, I hadn't tried that.
The rub is that I want to server the pdf that my report creates in a new tab, so i need to set the target to be '_blank'
I've tried the following code in the Server Code embed:
CASE p_web.GSV('MyLabelType')
OF '1'
PrintLabelType1(p_web)
OF '2'
PrintLabelType2(p_Web)
END
I've also tried calling
p_web.Windowopen('PrintLabelType1','_blank')
Which looks like the code generated by a standard button, but although I can see that my label routine is called, I don't get a pdf displayed to the browser.
Any thoughts?
Regards,
Neil.
-
Instead of having the button call printRoutine1 and another Button printRoutine2
Create a new source procedure called choosePntRoutine, or whatever.
make sure it has a parameter called p_web. ier the saem as the print routines.
Put all the logic into the source procedure to determine which print routine to call
ie.
if p_web.gsv('CallRtn') = 'prtrtn1'
prtrtn1(p_web)
end
The -Blank will still work and a new pdf page will be displayed.
-
Mike,
That's what I'd done to start with, and it does work until I have the situation where the report returns the alert "No Records Found" When that happens the alert doesn't display properly.
I'm wondering if I'm putting my my code in the wrong embed in the Source procedure?
My code is in the "before Div Header" embed.This is the only embed that I found that doesn't seem to try to format my call as HTML.
Regards,
Neil.
-
It must be a normal Clarion Source procedure
not a nettalk one.
it must just have the same parameters past to it . ie p_web.
The normal clarion sourcve procedure will determine which report proecdure to call with the nettalk extention
-
Mike, I must be doing something stupid.
If I convert my netwebsource procedure to be a normal Clarion source procedure, I can't call that procedure from a button. I get an error saying the "page cannot be found" which kinda makes sense as it isn't a web procedure any more.
If I call my clarion source from the server code of my button, surely I'm back to square one, because I can't set my print procedure to have a target _blank.
I'm lost....
Regards,
Neil.
-
Hi Neil,
At what point do you know the report name? ie as the form opens or after they do some stuff on the form?
Cheers,
Kev
-
Hi Kev,
After they've filled a load of data into the form. That determines what report gets called.
Regards,
Neil.
-
ok, try this...
For your print button add a URL but make it a session value
Create a routine for your report logic and move it from the report button into this routine. In this routine update the session value added to the report button to the report you want to run.
As a user fills in info call this routine and add the print button to the refresh list. This will update the URL on the browser.
Let us know how you get on...
Cheers,
Kevin
-
Kevin, what a cool idea.
It works like a charm!
Thank you very much for your help.
Regards,
Neil.