<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Filtering component for your tables</title>
	<atom:link href="http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/</link>
	<description>Technical weblog for articles and titorials related to web development.</description>
	<lastBuildDate>Wed, 01 Sep 2010 10:15:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17779</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Mon, 09 Aug 2010 10:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17779</guid>
		<description>Hi Nik!

Cool! It&#039;s working! Thanx a lot!!!!

Best regards,
Dmitry</description>
		<content:encoded><![CDATA[<p>Hi Nik!</p>
<p>Cool! It&#8217;s working! Thanx a lot!!!!</p>
<p>Best regards,<br />
Dmitry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik Chankov</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17778</link>
		<dc:creator>Nik Chankov</dc:creator>
		<pubDate>Mon, 09 Aug 2010 09:37:30 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17778</guid>
		<description>I&#039;ve changed the component (please get the new version of it from the post). Basically the change is in generateCondition() function.

Now it will accept
“string”=&gt;array(“LOWER(%1\$s) LIKE LOWER(&#039;%%%2\$s%%&#039;)”),

BTW, thanks for pointing this out. it&#039;s nice addition to the component.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve changed the component (please get the new version of it from the post). Basically the change is in generateCondition() function.</p>
<p>Now it will accept<br />
“string”=>array(“LOWER(%1\$s) LIKE LOWER(&#8216;%%%2\$s%%&#8217;)”),</p>
<p>BTW, thanks for pointing this out. it&#8217;s nice addition to the component.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17774</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Mon, 09 Aug 2010 08:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17774</guid>
		<description>It&#039;s not the oracle syntax problem it&#039;s a wrong translation of the string:

If I use 
&quot;string&quot;=&gt;array(&quot;LOWER(%1\$s) LIKE LOWER(%%%2\$s%%)&quot;),

I get 
WHERE ((LOWER(FIELD) LIKE LOWER(%VALUE%) &#039;&#039;) OR ...

the proper version would be
WHERE ((LOWER(FIELD) LIKE LOWER(&#039;%VALUE%&#039;)) OR ...</description>
		<content:encoded><![CDATA[<p>It&#8217;s not the oracle syntax problem it&#8217;s a wrong translation of the string:</p>
<p>If I use<br />
&#8220;string&#8221;=&gt;array(&#8220;LOWER(%1\$s) LIKE LOWER(%%%2\$s%%)&#8221;),</p>
<p>I get<br />
WHERE ((LOWER(FIELD) LIKE LOWER(%VALUE%) &#8221;) OR &#8230;</p>
<p>the proper version would be<br />
WHERE ((LOWER(FIELD) LIKE LOWER(&#8216;%VALUE%&#8217;)) OR &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik Chankov</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17773</link>
		<dc:creator>Nik Chankov</dc:creator>
		<pubDate>Mon, 09 Aug 2010 08:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17773</guid>
		<description>Dmitry,

bacause this component is written for MySQL probaby that&#039;s why with Oracle it doesn&#039;t work properly. I mean data types. Probably you have to check what kind of columns are returned from the table and modify the array keys (“string”, “text”, “date”, “datetime”) and to change them in the $fieldFormatting array.

About the second thing - Cake wraps the value of the string with quotes (especially if it&#039;s a text). That&#039;s why use:

“string”=&gt;array(“LOWER(%1\$s) LIKE LOWER(%%%2\$s%%)”),

note that now everything is array node rather the key=&gt;value pair - &quot;,&quot; are removed.</description>
		<content:encoded><![CDATA[<p>Dmitry,</p>
<p>bacause this component is written for MySQL probaby that&#8217;s why with Oracle it doesn&#8217;t work properly. I mean data types. Probably you have to check what kind of columns are returned from the table and modify the array keys (“string”, “text”, “date”, “datetime”) and to change them in the $fieldFormatting array.</p>
<p>About the second thing &#8211; Cake wraps the value of the string with quotes (especially if it&#8217;s a text). That&#8217;s why use:</p>
<p>“string”=>array(“LOWER(%1\$s) LIKE LOWER(%%%2\$s%%)”),</p>
<p>note that now everything is array node rather the key=>value pair &#8211; &#8220;,&#8221; are removed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17772</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Mon, 09 Aug 2010 08:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17772</guid>
		<description>please try &quot;string&quot;=&gt;array(&quot;LOWER(%1\$s) LIKE LOWER(&quot;, &quot;%%%2\$s%%)&quot;),

it has just one problem :
%)&#039;)</description>
		<content:encoded><![CDATA[<p>please try &#8220;string&#8221;=&gt;array(&#8220;LOWER(%1\$s) LIKE LOWER(&#8220;, &#8220;%%%2\$s%%)&#8221;),</p>
<p>it has just one problem :<br />
%)&#8217;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17771</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Mon, 09 Aug 2010 08:15:29 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17771</guid>
		<description>Hi Nik,

nothing of them works.

I would save the types &quot;string&quot;, &quot;text&quot;, &quot;date&quot;, &quot;datetime&quot;.

Even if I use 
var $fieldFormatting    = array(
                                    array(&quot;LOWER(%1\$s) LIKE LOWER(%2\$s%%)&quot;)
                    );

I get 
((FIELD = &#039;VALUE&#039;) OR ...


Lower will not be translated prerly.

I&#039;m almoust at the goal, if you write
&quot;string&quot;=&gt;array(&quot;LOWER(%1\$s) LIKE LOWER&quot;, &quot;(%%%2\$s%%)&quot;),

you will get
((LOWER(FIELD) LIKE LOWER &#039;(%VALUE%)&#039;) OR ...


Only the last &quot;)&quot; is wrong, I don&#039;t know how to fix it.</description>
		<content:encoded><![CDATA[<p>Hi Nik,</p>
<p>nothing of them works.</p>
<p>I would save the types &#8220;string&#8221;, &#8220;text&#8221;, &#8220;date&#8221;, &#8220;datetime&#8221;.</p>
<p>Even if I use<br />
var $fieldFormatting    = array(<br />
                                    array(&#8220;LOWER(%1\$s) LIKE LOWER(%2\$s%%)&#8221;)<br />
                    );</p>
<p>I get<br />
((FIELD = &#8216;VALUE&#8217;) OR &#8230;</p>
<p>Lower will not be translated prerly.</p>
<p>I&#8217;m almoust at the goal, if you write<br />
&#8220;string&#8221;=&gt;array(&#8220;LOWER(%1\$s) LIKE LOWER&#8221;, &#8220;(%%%2\$s%%)&#8221;),</p>
<p>you will get<br />
((LOWER(FIELD) LIKE LOWER &#8216;(%VALUE%)&#8217;) OR &#8230;</p>
<p>Only the last &#8220;)&#8221; is wrong, I don&#8217;t know how to fix it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik Chankov</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17544</link>
		<dc:creator>Nik Chankov</dc:creator>
		<pubDate>Fri, 06 Aug 2010 18:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17544</guid>
		<description>Dmitry,

Doing following format I believe it&#039;s enough:

$this-&gt;Filter-&gt;fieldFormatting[&quot;string&quot;]=array(&quot;LOWER(%1\$s) LIKE&quot;, &quot;LOWER(%2\$s%%)&quot;);

This way either the field and string will be lower cased and this will be pretty much enough.

If this doesn&#039;t working (the second part of the array is quoted) try
$this-&gt;Filter-&gt;fieldFormatting[&quot;string&quot;]=array(&quot;LOWER(%1\$s) LIKE LOWER(%2\$s%%)&quot;);

If you don&#039;t want to touch the component you can add this code in the AppController::beforeFilter() otherwise just replace the variable in the Filter component. :)</description>
		<content:encoded><![CDATA[<p>Dmitry,</p>
<p>Doing following format I believe it&#8217;s enough:</p>
<p>$this-&gt;Filter-&gt;fieldFormatting["string"]=array(&#8220;LOWER(%1\$s) LIKE&#8221;, &#8220;LOWER(%2\$s%%)&#8221;);</p>
<p>This way either the field and string will be lower cased and this will be pretty much enough.</p>
<p>If this doesn&#8217;t working (the second part of the array is quoted) try<br />
$this-&gt;Filter-&gt;fieldFormatting["string"]=array(&#8220;LOWER(%1\$s) LIKE LOWER(%2\$s%%)&#8221;);</p>
<p>If you don&#8217;t want to touch the component you can add this code in the AppController::beforeFilter() otherwise just replace the variable in the Filter component. <img src='http://nik.chankov.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17530</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Fri, 06 Aug 2010 13:09:51 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17530</guid>
		<description>Hi Nik,

I have one more question about the $fieldFormatting. It&#039;s concerning case insensitive search.

I would like to have something like

select &#039;TEST&#039; from dual
where (LOWER(&#039;sera&#039;) LIKE &#039;%&#039; &#124;&#124; LOWER(&#039;SERA&#039;) &#124;&#124; &#039;%&#039;);


How should I change the $fieldFormatting?
It should be something like 

&quot;string&quot;=&gt;array(&quot;LOWER(%1\$s) LIKE &quot;, &quot;%%% &#124;&#124;&#124; LOWER(2\$s) &#124;&#124; %%&quot;),

Do you know other solution for the case insensitive search?</description>
		<content:encoded><![CDATA[<p>Hi Nik,</p>
<p>I have one more question about the $fieldFormatting. It&#8217;s concerning case insensitive search.</p>
<p>I would like to have something like</p>
<p>select &#8216;TEST&#8217; from dual<br />
where (LOWER(&#8216;sera&#8217;) LIKE &#8216;%&#8217; || LOWER(&#8216;SERA&#8217;) || &#8216;%&#8217;);</p>
<p>How should I change the $fieldFormatting?<br />
It should be something like </p>
<p>&#8220;string&#8221;=&gt;array(&#8220;LOWER(%1\$s) LIKE &#8220;, &#8220;%%% ||| LOWER(2\$s) || %%&#8221;),</p>
<p>Do you know other solution for the case insensitive search?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17378</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Wed, 04 Aug 2010 14:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17378</guid>
		<description>Ok.
It should be:

                if(!empty($this-&gt;data[&#039;Model&#039;][&#039;search_value&#039;]) &amp;&amp; $this-&gt;data[&#039;Model&#039;][&#039;search_value&#039;]){
                  $this-&gt;data[&#039;Model&#039;][&#039;field1&#039;] = $this-&gt;data[&#039;Model&#039;][&#039;search_value&#039;];
                  $this-&gt;data[&#039;Model&#039;][&#039;field2&#039;] = $this-&gt;data[&#039;Model&#039;][&#039;search_value&#039;];
                  unset($this-&gt;data[&#039;Model&#039;][&#039;search_value&#039;]);
                }</description>
		<content:encoded><![CDATA[<p>Ok.<br />
It should be:</p>
<p>                if(!empty($this-&gt;data['Model']['search_value']) &amp;&amp; $this-&gt;data['Model']['search_value']){<br />
                  $this-&gt;data['Model']['field1'] = $this-&gt;data['Model']['search_value'];<br />
                  $this-&gt;data['Model']['field2'] = $this-&gt;data['Model']['search_value'];<br />
                  unset($this-&gt;data['Model']['search_value']);<br />
                }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry</title>
		<link>http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/comment-page-1/#comment-17377</link>
		<dc:creator>Dmitry</dc:creator>
		<pubDate>Wed, 04 Aug 2010 14:29:37 +0000</pubDate>
		<guid isPermaLink="false">http://nik.chankov.net/2008/03/01/filtering-component-for-your-tables/#comment-17377</guid>
		<description>Notice (8): Undefined index: search_value [APP/controllers/models_controller.php, line 10]
String 10 is &quot;if(!empty($this-&gt;data) &amp;&amp; $this-&gt;data[&#039;search_value&#039;]){&quot;

Notice (8): Undefined index: search_value [APP/controllers/components/filter.php, line 62]
String 62 is &quot;if(isset($this-&gt;fieldFormatting[$columns[$field]])){&quot;</description>
		<content:encoded><![CDATA[<p>Notice (8): Undefined index: search_value [APP/controllers/models_controller.php, line 10]<br />
String 10 is &#8220;if(!empty($this-&gt;data) &amp;&amp; $this-&gt;data['search_value']){&#8221;</p>
<p>Notice (8): Undefined index: search_value [APP/controllers/components/filter.php, line 62]<br />
String 62 is &#8220;if(isset($this-&gt;fieldFormatting[$columns[$field]])){&#8220;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
