Groups > dBase > dBase Internet > Re: stymied on "Sorry" Page




stymied on "Sorry" Page

stymied on "Sorry" Page
Thu, 16 Aug 2007 13:04:05 -050
In the example below I have 2 locations where I call the "Sorry" page.
On 
the first the "Sorry" page does not execute.  But it does on the
second.

What am I not seeing in this code?

Try  // Error trap entire CGI applet.

   // Create new instance of the Web Class
   set procedure to WebClass.cc additive
   oCGI = new CGISession()

   // Connect to the Web Server (StdIn/StdOut)
   oCGI.Connect()

   Public cSearch
   cSearch    = trim(oCGI["SEARCH"])

if not empty(cSearch)
   //some code here that works fine
else
//~~~~~~~~~~~~~
//if cSearch is empty here the "Sorry" Page dose not execute.
//I have confirmed this branch is taken on empty cSearch, so
//that is not the problem.
//~~~~~~~~~~~
    oCGI.sorryPage("Nothing was requested.")
endif

// some code here that works fine

if q.rowset.count() > 0
    oCGI.streamHeader('Search Results')
    oCGI.StreamBody()
    oCGI.streamFooter()
else

//~~~~~~~~~~~~~
//this does work
//if the rowset count = 0 here the "Sorry" Page will execute.
//~~~~~~~~~~~
   oCGI.sorryPage("No records found.")
endif

catch (exception e)
    oCGI.errorPage(e)
endtry


Post Reply
Re: stymied on "Sorry" Page
Thu, 16 Aug 2007 13:19:35 -050
Claus,

Try replacing the line below

 cSearch    = trim(oCGI["SEARCH"])

With:


if oCGI.isKey('SEARCH')
  cSearch    = trim(oCGI["SEARCH"])
else
  cSearch = " "
endif

Dan Barbaria


"Claus Mygind" <cmygind@tsccorp.com> wrote in message 
news:h$iMBID4HHA.1432@news-server...
> In the example below I have 2 locations where I call the "Sorry"
page. On 
> the first the "Sorry" page does not execute.  But it does on the
second.
>
> What am I not seeing in this code?
>
> Try  // Error trap entire CGI applet.
>
>   // Create new instance of the Web Class
>   set procedure to WebClass.cc additive
>   oCGI = new CGISession()
>
>   // Connect to the Web Server (StdIn/StdOut)
>   oCGI.Connect()
>
>   Public cSearch
>   cSearch    = trim(oCGI["SEARCH"])
>
> if not empty(cSearch)
>   //some code here that works fine
> else
> //~~~~~~~~~~~~~
> //if cSearch is empty here the "Sorry" Page dose not execute.
> //I have confirmed this branch is taken on empty cSearch, so
> //that is not the problem.
> //~~~~~~~~~~~
>    oCGI.sorryPage("Nothing was requested.")
> endif
>
> // some code here that works fine
>
> if q.rowset.count() > 0
>    oCGI.streamHeader('Search Results')
>    oCGI.StreamBody()
>    oCGI.streamFooter()
> else
>
> //~~~~~~~~~~~~~
> //this does work
> //if the rowset count = 0 here the "Sorry" Page will execute.
> //~~~~~~~~~~~
>   oCGI.sorryPage("No records found.")
> endif
>
> catch (exception e)
>    oCGI.errorPage(e)
> endtry
>
>
> 

Post Reply
Re: stymied on "Sorry" Page
Thu, 16 Aug 2007 13:25:02 -050
Sometimes when you work on a problem a really long time, you just get 
frustrated as was the case here.  Well I solved the mystry.

I have a custom streamHeader( ) which executes a variable.  The custom 
streamHeader( ) executes even for the "Sorry" page (which I did not
know). 
Since the variable was not there, the header crashed when trying to execute 
(which is not too apparent from the error message.

So problem solved. Header now includes a test for "cSearch", if empty
skip 
that line of code.

Claus


"Claus Mygind" <cmygind@tsccorp.com> wrote in message 
news:h$iMBID4HHA.1432@news-server...
> In the example below I have 2 locations where I call the "Sorry"
page. On 
> the first the "Sorry" page does not execute.  But it does on the
second.
>
> What am I not seeing in this code?
>
> Try  // Error trap entire CGI applet.
>
>   // Create new instance of the Web Class
>   set procedure to WebClass.cc additive
>   oCGI = new CGISession()
>
>   // Connect to the Web Server (StdIn/StdOut)
>   oCGI.Connect()
>
>   Public cSearch
>   cSearch    = trim(oCGI["SEARCH"])
>
> if not empty(cSearch)
>   //some code here that works fine
> else
> //~~~~~~~~~~~~~
> //if cSearch is empty here the "Sorry" Page dose not execute.
> //I have confirmed this branch is taken on empty cSearch, so
> //that is not the problem.
> //~~~~~~~~~~~
>    oCGI.sorryPage("Nothing was requested.")
> endif
>
> // some code here that works fine
>
> if q.rowset.count() > 0
>    oCGI.streamHeader('Search Results')
>    oCGI.StreamBody()
>    oCGI.streamFooter()
> else
>
> //~~~~~~~~~~~~~
> //this does work
> //if the rowset count = 0 here the "Sorry" Page will execute.
> //~~~~~~~~~~~
>   oCGI.sorryPage("No records found.")
> endif
>
> catch (exception e)
>    oCGI.errorPage(e)
> endtry
>
>
> 

Post Reply
Re: stymied on "Sorry" Page
Thu, 16 Aug 2007 13:30:06 -050
Thanks Dan,

It would not make a difference as it is another variable that is missing.

I use this routine as a standard for all my searches.  The response page is 
always the same, just differnt content depending on the table being 
quieried. I use a variable to load the specific content info.  That was what 
was missing in the first instance of the "Sorry" page.

It was only after examining the content of the 2nd instance of the
"Sorry" 
page that I saw a bunch of stuff I load in the header, that I realized the 
Sorry page was using my StreamHeader()

Claus

"Dan Barbaria" <daniel.barbaria at ops.org> wrote in message 
news:ypsCRRD4HHA.1196@news-server...
> Claus,
>
> Try replacing the line below
>
> cSearch    = trim(oCGI["SEARCH"])
>
> With:
>
>
> if oCGI.isKey('SEARCH')
>  cSearch    = trim(oCGI["SEARCH"])
> else
>  cSearch = " "
> endif
>
> Dan Barbaria
>
>
> "Claus Mygind" <cmygind@tsccorp.com> wrote in message 
> news:h$iMBID4HHA.1432@news-server...
>> In the example below I have 2 locations where I call the
"Sorry" page. On 
>> the first the "Sorry" page does not execute.  But it does on
the second.
>>
>> What am I not seeing in this code?
>>
>> Try  // Error trap entire CGI applet.
>>
>>   // Create new instance of the Web Class
>>   set procedure to WebClass.cc additive
>>   oCGI = new CGISession()
>>
>>   // Connect to the Web Server (StdIn/StdOut)
>>   oCGI.Connect()
>>
>>   Public cSearch
>>   cSearch    = trim(oCGI["SEARCH"])
>>
>> if not empty(cSearch)
>>   //some code here that works fine
>> else
>> //~~~~~~~~~~~~~
>> //if cSearch is empty here the "Sorry" Page dose not
execute.
>> //I have confirmed this branch is taken on empty cSearch, so
>> //that is not the problem.
>> //~~~~~~~~~~~
>>    oCGI.sorryPage("Nothing was requested.")
>> endif
>>
>> // some code here that works fine
>>
>> if q.rowset.count() > 0
>>    oCGI.streamHeader('Search Results')
>>    oCGI.StreamBody()
>>    oCGI.streamFooter()
>> else
>>
>> //~~~~~~~~~~~~~
>> //this does work
>> //if the rowset count = 0 here the "Sorry" Page will
execute.
>> //~~~~~~~~~~~
>>   oCGI.sorryPage("No records found.")
>> endif
>>
>> catch (exception e)
>>    oCGI.errorPage(e)
>> endtry
>>
>>
>>
>
> 

Post Reply
about | contact