PDA

View Full Version : DataAssist & Search functionality


fragop363190
05-19-2009, 12:05 PM
Ok i got a public page that i have created using DataAssist and Public template with single record per row usage. I also checked search on page.

Everything created fine.

In my search box i got 2 search paramets.

Now i run into this problem probably easy to resolve. This page has to be filtered to produce specific records using $_GET requests.

im geting to this page by a URL like www.example.com/results.php?subCat=x where x is a number.

That is why i filtered the recordset generated by DataAssist with a WHERE clause and a parameter in order to filter by the subCat value.

Everything ok till i press the search button... It passes to the recordset only the 2 values from the search and cause i got my own WHERE clause in the primary recordset and no subCat value is passed i dont see anything in page.

I tried adding to append to the form code action="results.php?subCat=<?php $_GET['subCat'] so it keeps from primary link the subCat thing and repost it on submit of form (search button) but it doesnt append the subCat=x just goes to results.php and appends the filters of the search box (the 2 ones refered above).

I also tried inserting a 3rd HIDDEN parameter in the search box by using the server behavior, gave it to take that $_GET thing from above so it filters my recordset and submit form correctly.

if i do that i need to take out my filter from the where clause but then...at the begining wihtout pressing the search button all records will be shown and i want them filtered from start. Just want to add 2 more search choices availalbe to public and ofc always filterd by what id i pass it.

I can not make it work correctly.
Need some help/propositions here.

Ray Borduin
05-19-2009, 01:53 PM
Instead of adding the WHERE clause in the recordset, add it as the default where clause in the DataAssist Search server behavior and leave the recordset without a where clause. I think that will give you the result that you want.

fragop363190
05-19-2009, 11:02 PM
Ok this works.

I added default where clause but had to manualy fix it in code

"$WADbSearch1_DefaultWhere = "idsct_cmp = ".$_GET["S_idsct_cmp"];"

because i need to get the parameter also from the get (initial filtering without user interactin). But if i put the .$_GET["S_idsct_cmp"] the behavior stops showing on the DWCS4 panel. Minor problem but still its a small bug. I supposse DWCS4 wants some stuff in specific ways so probably need to work it as DW parameters code and then use it in there but im not a DW code expert your tech guys should know why and how to fix it to a next release.

But ... there is a problem with INCLUDE in search engine. I got a column named name_suf and im using a text field(edit in search behavior) using the "INCLUDE" option to search in it.

It just doesn't work. I even fixed a FULL-TEXT index in my db on that column in case it is required.

example : search function passes the above line

?S_municipality_cmp=&S_idsct_cmp=28&S_name_cmp=pk

S_name_cmp is the field/attribute that gets the users input from the text box. Here the user typed "pk" and the search engine should search in my table the appropriate column for the text "pk" inside it. i don't know what it does but it is not working.

Here is the code on top at php portion

$WADbSearch1->addComparisonFromEdit("name_cmp","S_name_cmp","AND","Includes",0);

so it should be passed ok in the search.

Need it to work asap please.

fragop363190
05-19-2009, 11:23 PM
Ok fixed it using a hidden field and the Default Where as yyou said, it worked like a charm.

But Include of text field isnt working. It doesn't filter records based on the partial name of the companies. as i said, i even added a FULL-TEXT index to that column.

Please advise maybe im doing sth wrong.

Ray Borduin
05-20-2009, 07:15 AM
What trigger are you using? Is it filtering it at all?

Try writing the resulting where clause to the page and see if you can spot what is wrong with it.... should be something like: WADbSearch1->WhereClause

fragop363190
05-20-2009, 10:15 PM
Yes there is code for it. And in general the search functionality for the Dynamic Menu and for the hidden field wok fine. Only the text/edit box which is pointed as INCLUDE isnt filtering the records. The other 2 are pointed as "=" and filter fine.
Here is the code you requested...

if (1 == 1) {
$_SESSION["WADbSearch1_companies_Public_Results"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_companies_Public_Results"]) && $_SESSION["WADbSearch1_companies_Public_Results"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_companies_Public_Results"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';

fragop363190
05-21-2009, 06:18 AM
Include Search Functinality not working. Please advise.

Ray Borduin
05-21-2009, 07:51 AM
What is the trigger you are using for the search?

fragop363190
05-22-2009, 04:25 AM
Attaching page in support ticket.

Include is not working. All created with wizzard.