-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'IN' operator for tvFilters #64
base: master
Are you sure you want to change the base?
'IN' operator for tvFilters #64
Conversation
…eparated value explicitly using FIND_IN_SET.
I assume this REQUIRES that a TV has a value list separated by commas instead of the default || separator normally used by the TV's? |
I believe so. Basically uses the value from an autotag TV which I think uses a comma separated list last time I checked. Jeff Whitfield • Sent from my iPhone • On Jun 15, 2012, at 1:56 PM, Jason Cowardreply@reply.github.com wrote:
|
Verified and, yeah, requires comma separated list. Reason is due to the FIND_IN_SET function requires a comma separated list when searching an array. |
It seems to be the right "operator" FIND_IN_SET that i need it, but, somehow it doesn't work to me. sorry for my english :( |
Why is the IN operator still not included? Tried it and it works perfect! Makes life easier... |
@christianseel I hesitated to include this because it uses a MySQL-specific solution and I wanted to maintain compat with SQLSRV (at least at the time I did). I also simply have not tried it and saw the report of it not working above. I'll look into it today. |
That makes sense. But I think it's ok if the documentation highlights that this operator is mysql-only, since it's really usefull. |
here is my "snippet.getresources.php" script. @opengeek i'm not sure if it is the best way, but it works to me. usage: &tvFilters= ' . print_r($properties, true) .''); } else { $output[]= $resourceTpl; } $idx++; } /\* output */ $toSeparatePlaceholders = $modx->getOption('toSeparatePlaceholders',$scriptProperties,false); if (!empty($toSeparatePlaceholders)) { $modx->setPlaceholders($output,$toSeparatePlaceholders); return ''; } $output = implode($outputSeparator, $output); $toPlaceholder = $modx->getOption('toPlaceholder',$scriptProperties,false); if (!empty($toPlaceholder)) { $modx->setPlaceholder($toPlaceholder,$output); return ''; } print $output; |
Hm. Any news on the IN operator? It would be very useful - in the past I always had to make dirty workarounds, changes in data representation or coding own solutions (for already existing functionality of getresources)... |
Added an 'IN' operator to tvFilters. This uses the MySQL FIND_IN_SET function and will allow for filtering a comma delimited field value explicitly with a given value. Will also be adding a pull request for an update to tagLister that accommodates these changes.