NetTalk Central

Author Topic: Calling Procedure from a NewWebSource  (Read 2982 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Calling Procedure from a NewWebSource
« on: November 25, 2012, 07:29:19 PM »
NT 6.48
I have an application that was based on static pages with dynamic content.  In one situation, I had a static page with an html button that called a NetWebSource procedure which tested some variables and then called a specific html static page.  The basic code for the NewWebSource procedure was:

If p_web.GSV('myvariable') = 'Y'
   packet = '/mywebpage.html'
Else
   packet = '/myotherpage.html'
End
Do Sendpacket

I am now converting the app to a dynamic app.  I have a memory netwebform with some variables that will be used as session variables to guide later processing decisions.  The form has an html button on it that calls a NetWebSource procedure where the variable testing is done.  However, now I am calling nettalk procedures instead of html static pages.  I've tried substituting the html pages in the code above with the nettalk procedure, but I get errors saying the xml file has not CSS.    The basic method I am trying is:

If p_web.GSV('myvariable') = 'Y'
   packet = '<!-- Net:mynettalkprocedure -->'
Else
   packet = '<!-- Net:myothernettalkprocedure -->'
End

By the way, the procedure I am, at the moment, trying to call is one of a series of reports.  So, I am also interested in how I would get the report (pdf) to open in a new target window from this netwebsource procedure.
Thanks,
Mike Springer


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Calling Procedure from a NewWebSource
« Reply #1 on: November 25, 2012, 10:19:20 PM »
Hi Mike,

I think you will need to post an example Mike - there's too much going on here for me to comment in general.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Calling Procedure from a NewWebSource
« Reply #2 on: November 26, 2012, 04:07:28 AM »
Bruce,
I have attached a zip file of a simple app to illustrate the problem.  A few notes about the contents.
1. C6.3 app
2. There is an image (for the html button) in the zip file that needs to be copied to your /web/images folder.

I've also attached a screen image of the message being displayed when the html button is clicked.  You can see that the NetWebSource procedure (PrintContributionCallSource) is being called but you get the message shown in the image rather than the desired print procedure being called.

To summarize the app:

PrintContributionHistory is a memory form that contains an html button image with a call to a NetWebSource procedure.  In this example app, the only variable that is used is the "From Date".  It is the variable that will be used later to determine which print program to call.

PrintContributionCallSource is the NetWebSource procedure.  It simply tests one variable (the "From Date") to decide which of two print reports are to be run.  The calling code in this NetWebSource procedure is:

!*** Determine which print program to call ***
 if p_web.GSV('FromDate') <> 0
    packet = '<!-- Net:PrintContrHistNameSeq -->'
 Else
    packet = '<!-- Net:PrintEnvHistory -->'
 End

Bruce, also, since I am trying to call print procedures from this NetWebSource procedure, how do I also cause it to open a new target window for the PDF to display in?

Thanks for you advice,
Mike Springer



[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Calling Procedure from a NewWebSource
« Reply #3 on: November 26, 2012, 10:57:30 PM »
Hi Mike,

ok, you've made a good start. But you're still a little hooked on the "static" approach - albeit this time you've embedded static stuff inside a generated page - which is better.

But rather than try and hack this - why not just add the button to the form, as a button? Perhaps do that and then let's see where we are.

while you're at it, get the heading on the form right - there's no need for all the embedded html, much less the embedded css. I know it seems silly, but getting these basic building blocks right now will pay off in spades later on.

I suggest your NetWebSource is also really a netWebPage. It seems to me that you're wanting to open a new tab with the result of the button press, and that means you're opening a new page.

Feel free to post another example when that's done.

cheers
Bruce

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Calling Procedure from a NewWebSource
« Reply #4 on: November 27, 2012, 04:53:30 PM »
Hey Bruce,
Thanks for the advice.  I implemented your suggestion of using a NetWebPage and got it to work just like you suggested it would.

And, yes, I am making progress moving away from the static pages - thanks for your encouragement.
Mike Springer