All times are UTC + 1 hour




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
  Print view

Author Message
PostPosted: Mon Dec 08, 2008 3:56 pm 
Offline

Joined: Wed Dec 03, 2008 7:10 pm
Posts: 23
rwolverine wrote:
I had forgotten about this post, and ran into this again recently :(

I havn't found a resolution other than to add a field to my nodes and search that instead :/ Very ugly but does get around what I wanted to do.


I don't know if this is the same thing but I added multiple fields using the 'addListColumn' function - I now have a FirstName and LastName column instead of a Customer column, but at least I can search on it.


Top
 Profile  
 

PostPosted: Mon Dec 08, 2008 7:09 pm 
Pro
Offline

Joined: Wed Jan 31, 2007 1:50 am
Posts: 552
Location: Michigan USA.
no, mine involved, an extra atkattribute, where i use pre add and update to concatinate my manytoone into and then search on that instead :/ Very ugly


Top
 Profile  
 

PostPosted: Thu Mar 26, 2009 9:38 am 
Offline

Joined: Wed Mar 18, 2009 10:31 am
Posts: 7
Is there a correct solution for this already? I have the same problem :/


Top
 Profile  
 

PostPosted: Thu Sep 03, 2009 6:21 pm 
Regular
Offline

Joined: Tue Jun 09, 2009 5:06 pm
Posts: 55
Did this ever get solved? I seem to be experiencing the same thing:
AJAX search works, but pushing the search button does not.
This is when the descriptor_def on the one side of the manytoone looks like "[fullname] ([emp_id])".
Also, I noticed the search box (and AJAX dropdown) is only the width of [emp_id] rather than a width more appropriate for "[fullname] ([emp_id])".

Thanks,
-Vince


Top
 Profile  
 

PostPosted: Thu Sep 10, 2009 2:37 pm 
Regular
Offline

Joined: Tue Jun 09, 2009 5:06 pm
Posts: 55
Am I the only one still seeing this? Filters appear to be broken when using AF_LARGE and a descriptor containing more than one field....
-Vince


Top
 Profile  
 

PostPosted: Fri Sep 11, 2009 5:06 pm 
Regular
Offline

Joined: Tue Jun 09, 2009 5:06 pm
Posts: 55
I found that I had a problem that was specific to Oracle (and my submitted func_concat_ws for Oracle) and one that I think folks using any database might see.

The problem all might see involves values that contain spaces with m2o AF_LARGE and descriptors with multiple fields (in my case an employee's fullname and employee ID were in the descriptor). In class.atkmanytoonerelation.inc, in function getConcatFilter (near the end, around line 2307) you'll find the following:
Code:
          // to search independent of characters between tags, like spaces and comma's,
          // we remove all these separators so we can search for just the concatenated tags in concat_ws [Jeroen]
          foreach ($concatSeparators as $separator)
          {
            $value = str_replace($separator, "", $value);
          }
          $value = str_replace(" ", "", $value); //add this line, to compensate for func_concat_ws stripping spaces
          $db = $this->getDb();
          $searchcondition = "UPPER(".$db->func_concat_ws($concatTags, "", true).") LIKE UPPER('%".$value."%')";

I added the line after the foreach loop because func_concat_ws (2 lines later) strips spaces within fields as well as between them. Without the added line, I was ending up with comparisons like this:
"JOEASMITH45632" LIKE "%JOE A SMITH45632%"
which, of course, was never true. This change errs on the side of finding extra matches if you have values that differ only in internal spaces.

For consistency's sake, and to make sure that this fix doesn't cause problem if the descriptor contains only one field, func_concat_ws in class.atkdb.inc should be changed from this:
Code:
    function func_concat_ws($fields, $separator, $remove_all_spaces = false)
    {
      if(count($fields)==0 or !is_array($fields)) return '';
      elseif(count($fields)==1)                   return $fields[0];
     
      if ($remove_all_spaces)
      {
        return "REPLACE ( CONCAT_WS('$separator', ".implode(',',$fields)."), ' ', '') ";
      }
      else
      {
        return "CONCAT_WS('$separator', ".implode(',',$fields).")";       
      }
    }

to something like this:
Code:
    function func_concat_ws($fields, $separator, $remove_all_spaces = false)
    {
      if(count($fields)==0 or !is_array($fields)) return '';
      elseif(count($fields)==1) $rtnval=$fields[0];
      else $rtnval="CONCAT_WS('$separator', ".implode(',',$fields).")";

      if ($remove_all_spaces) $rtnval= "REPLACE ( ".$rtnval.", ' ', '') ";
      return $rtnval;
    }


For changes/issues specific to Oracle, see this topic:
http://atk-framework.com/forum/forum/viewtopic.php?t=18891

I hope this helps others struggling with this.
-Vince


Top
 Profile  
 

Re: AF_SEARCHABLE on relations
PostPosted: Sat Sep 01, 2018 2:22 am 
Regular
User avatar
Offline

Joined: Thu Aug 25, 2011 9:31 pm
Posts: 311
Location: Mumbai, India
Is this taken care in 6.5 / 6.6?


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group