close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Data assist search, need to group search criteria

Thread began 3/01/2012 7:56 am by Base5 Designs | Last modified 3/02/2012 6:27 am by Base5 Designs | 692 views | 3 replies

Base5 Designs

I think i have worked this out, here is what i have done incase anyone else runs into this.

Initially i tried simply putting an opening bracket into the field name where i wanted the grouping to start
$WADbSearch1->addComparison("(defaultcollectionname_rec","".$_GET['style'] ."","AND","=",0);

and where i wanted the grouping to end:

$WADbSearch1->addComparison("bcollectionname_rec)","".$_GET['style'] ."","OR","=",0);

this generated the following sql:

AND (artist_rec LIKE 'C%') AND ((defaultcollectionname_rec = 'Northern and 60s') OR (acollectionname_rec = 'Northern and 60s') OR (bcollectionname_rec) = 'Northern and 60s')

Although this seems to work the closing bracket appears after the fieldname not after the full statement.
I dont like malformed code so i went back to the drawing board and came up with the soloution...

I edited the helper.php file and added the following function (just before the create comparison function)

php:
function addcloseGrouping() {

    $this->whereClause=$this->whereClause.")";
  }


i changed the code on my page and applied an opening bracket to the fieldname of where i wanted the grouping to start, after the last field where i want the grouping to end i added a call to the new function closeGrouping:

php:
//comparison list additions

  $WADbSearch1->addComparison("artist_rec","".$currentAlpha  ."","AND","Begins With",0);
  $WADbSearch1->addComparisonFromEdit("formatname_rec","45s","AND","=",0);
  $WADbSearch1->addComparison("(defaultcollectionname_rec","".$_GET['style']  ."","AND","=",0);
  $WADbSearch1->addComparison("acollectionname_rec","".$_GET['style']  ."","OR","=",0);
  $WADbSearch1->addComparison("bcollectionname_rec","".$_GET['style']  ."","OR","=",0);
  $WADbSearch1->closeGrouping();



my final sql statement that is generated looks like this:

php:
AND (artist_rec LIKE 'C%') AND ((defaultcollectionname_rec = 'Northern and 60s') OR (acollectionname_rec = 'Northern and 60s') OR (bcollectionname_rec = 'Northern and 60s'))



which is correctly formatted code and seems to work as expected.

It would be nice if someone from webassist could comment on this and let me know if here is a better or easier way of doing this. or if this method is sufficient.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...