multisearch request

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 27, 2020   (RSS)

In an old post from 2013 there is reference to a custom where clause. https://www.interactivetools.com/forum/forum-posts.php?postNum=2229396#post2229396

Is it possible to add this functionality to the core Viewer Functions.

// Note: This function is EXPERIMENTAL and may change in future
function searchMultipleTables($searchTables, $searchOptions) {

...
$where            = _addWhereConditionsForSpecialFields($schema, '', $searchOptions);

if(@$tableOptions['customWhere']){
      if($where){
        $where .= "AND ".$tableOptions['customWhere'];
      }else{
        $where = 'WHERE '.$tableOptions['customWhere'];
      }
}

...
Jeff Shields

By daniel - February 26, 2020

Hi Jeff,

Could you please clarify specifically which functions you're referring to, and what you'd like to be able to do with them? The getRecords() function already supports the "where" and "orWhere" options which can accept custom WHERE clauses - are you looking for something else?

Thanks,

Daniel
Technical Lead
interactivetools.com

By kitsguru - February 26, 2020 - edited: February 26, 2020

In my post I specifically mention the function name. it is called by the multisearch.php file for doing site wide searches. in the post I referenced, it showed a hack to add a custom where clause.

// Note: This function is EXPERIMENTAL and may change in future
function searchMultipleTables($searchTables, $searchOptions) {

...
$where            = _addWhereConditionsForSpecialFields($schema, '', $searchOptions);

if(@$tableOptions['customWhere']){
      if($where){
        $where .= "AND ".$tableOptions['customWhere'];
      }else{
        $where = 'WHERE '.$tableOptions['customWhere'];
      }
}

THe function is searchMultipleTables and is in the viewer-functions file. The explanation for the use case is in the old post.

my suggestion was to make this minor change to the code immediately after the where clause so we it wouldn’t get overwritten when we update cmsb.

Jeff Shields

By daniel - February 27, 2020

Hi Jeff,

Sorry - I misunderstood your original post, thanks for the clarification. That is a fairly simple change, and I've added it to be released with the next CMSB version.

Cheers,

Daniel
Technical Lead
interactivetools.com