Hello,
I have a Search page where a user can either search by selecting one of the radio
buttons, writing a name in a textbox and
clicking Search, or he/ she can search by alphabetical order. The alphabetical order
works only for one of the properties of
the products. A user clicks on any letter link and gets all the profucts starting
with according letter along with their definitions.
However, the alphabetical order doesn't work if I don't search for a product with a
radio button first. It's like the alphabetical
order needs a "push" before it can give the correct results. The following is the
code I use the Search button and for the letter
"A". Does anyone know what's wrong with it so that it could work properly?
I really appreciate your help.
This is for the main page where the search criterias are displayed:
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");
doQuery.clearDynamicCriteria ();
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>
This is 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]