Hello,
In my application, I am using Java Events to add the dynamic criteria.  This is a 
Search page where a user can either search with
radio buttons or by alphabetical order.

With radio buttons means that he/ she chooses either one of the names in three radio 
buttons, types in a product name, 
clicks on "Search" button, and, on the next screen, sees the product along with it's 
number and definition.
The alphabetical order works only for one of the properties of the products.  A user 
clicks on any letter link and gets all the 
products starting with according letter along with their definitions.

However, if the alphabetical order doesn't work if I don't search for a product with a 
radio button first.  It's like it needs a "push"
before starting to work.

Here is the code for the Java events that I have:

For the "Search Page"
public int btSearch_onWebEvent(CSpWebEvent event)
        {
                CSpValue source = (CSpValue) getDisplayFieldValue("rbSource");
                CSpValue name = (CSpValue) getDisplayFieldValue("tbName");
                        
                CSpider.putUserSessionObject("sesSource", source); 
                CSpider.putUserSessionObject("sesName", name);
                CSpider.putUserSessionObject("sesLetter", (CSpValue) new 
CSpString("NULL"));
                load("pgSearchPage");
                
                return(PROCEED);

        }



For the Next Page where the results are displayed:

        //[[SPIDER_EVENT<this_onBeforeDisplayEvent>
        public int this_onBeforeDisplayEvent(CSpDisplayEvent event)
        {
                CSpValue source = CSpider.getUserSessionObject("sesSource");
                CSpValue name = (CSpValue) new 
CSpString((CSpider.getUserSessionObject("sesName")).toString().toUpperCase());
                CSpValue letter = CSpider.getUserSessionObject ("sesLetter");
        
                CSpSelect doQuery = (CSpSelect) CSpider.getDataObject ("DoQuery");

//CSpHtml.write("Source - "+source+"<BR>\n");
                doQuery.clearDynamicCriteria ();

//CSpHtml.write("Letter - "+letter+"-<BR>\n");
//CSpHtml.write("Name - "+name);
                if (letter.toString().equals("NULL")) {
                        if (source.toString().equals("Sheet2_Finesse")) {
                                doQuery.addDynamicCriterion 
("Sheet2_Finesse",CSpCriteriaSQLObject.BEGINS_WITH_STR_OPERATOR, name);
                        }
                        else if (source.toString().equals("Sheet2__FID___")) {
                                doQuery.addDynamicCriterion 
("Sheet2__FID___",CSpCriteriaSQLObject.BEGINS_WITH_STR_OPERATOR, name);
                        }
                        else if (source.toString().equals("Sheet2_Reuters")) {
                                CSpHtml.write("\"" + doQuery.addDynamicCriterion 
("Sheet2_Reuters",CSpCriteriaSQLObject.BEGINS_WITH_STR_OPERATOR, name));
                        }
                }
                else {
                        doQuery.addDynamicCriterion 
("Sheet2_Finesse",CSpCriteriaSQLObject.BEGINS_WITH_STR_OPERATOR, letter);
                }
                doQuery.execute ();
                return (PROCEED);
        }
        //]]SPIDER_EVENT<this_onBeforeDisplayEvent>

For the Alphabetical order, just for letter "A":

public int hrA_onWebEvent(CSpWebEvent event)
        {
                CSpString letter = new CSpString("A");
                CSpider.putUserSessionObject("sesLetter", (CSpValue) letter); 
                load("pgSearchPage");
                return(PROCEED);
        }

Does anyone have any suggestions?  
Thanks,
Rimma




_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to