NetTalk Central

Author Topic: Calling procedures Conditionally  (Read 3699 times)

Binu

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Calling procedures Conditionally
« on: June 09, 2008, 07:27:46 AM »
Hello,

I have a NetWebForm, which is a report criteria form. This form has from and to dates and a check box. I would like to swith between procedures depending on whether the checkbox is ticked or not. IE If the Checkbox is ticked, then I want it to call x procedure and if it is unticked I would like it to call y procedure. I don't want to use a menu option as we have many variations of the same report presented differently. Thus, if you were to put all the reports seperately would give you a very large menu set.

My knowledge on web side of things is very very limited. I only know little bit of HTML. I started going through the examples provided with nettalk 4 and managed this far, but this seems a bit tricky to me.

Please help...

Thanks in advance.

Binu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Calling procedures Conditionally
« Reply #1 on: June 09, 2008, 11:25:08 PM »
Hi Binu,

What you really want to do here is create a procedure, called say "CallReport" that looks at the various options chosen by the user, and calls the appropriate report procedure. 

I'd probably use the NetWebPage procedure type for this, but I'd embed the code _before_ the procedure generates the header etc. In other words this NetWebPage is strictly just a decider, we don't want it to actually send any html.

So, we make it a NetWebPage, and we call it CallReport, so the URL for the "Print" button on the options form is set to 'CallReport' and the target is set to '_blank'.

Then In CallReport, as I say very eary, you can have something like the following;

If p_web.GetValue('Whatever')
  ReportA(p_web)
else
  ReportB(p_web)
End
Return

In the above code, ReportA, and ReportB are the two procedures you are choosing between. And "Whatever" is the checkbox variable on your options form that you mentioned.

Cheers
Bruce

Binu

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Calling procedures Conditionally
« Reply #2 on: June 10, 2008, 01:28:24 AM »
Thanks Bruce... that worked fine and exactly how I wanted.