Title: shortcode complex filter option (nested operators)
Last modified: August 22, 2016

---

# shortcode complex filter option (nested operators)

 *  Resolved [latsi008](https://wordpress.org/support/users/latsi008/)
 * (@latsi008)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/)
 * Hi, I would like to use the filter option of shortcodeS with nested conditions
   like the “name” is “Luke” and language1 is “English” or language2 is “English”
   and language-level1 is “Good” or language-level2 is “Good”.
 * Unfortunately something like that **doesn’t work for me**
 * $shortcode = ‘[cfdb-datatable form=”cv-form” id=”cf2dbtable” filter=”name=Luke&&
   language1=English||language2=English&&language-level1=Good||language-level2=Good”]’;
 * echo do_shortcode( $content );
 * **I would like something like that**:
 * in SQL we could say that what I want is a WHERE statement that would seem like
   that
 * name=Luke AND (language1=English OR language2=English) AND (language-level1 =
   Good OR language-level2 =Good)
 * How can I use the filter option of the shortcodes to accomplice a result same
   as the above query?
 * Thank you in advance!
 * [https://wordpress.org/plugins/contact-form-7-to-database-extension/](https://wordpress.org/plugins/contact-form-7-to-database-extension/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758545)
 * You would have to encode your filter logic in a transform [function](http://cfdbplugin.com/?page_id=1076)
   or class.
 * You could have it add a field that is the result of your boolean evaluation then
   filter on that new field.
 *  Thread Starter [latsi008](https://wordpress.org/support/users/latsi008/)
 * (@latsi008)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758710)
 * Thank you for your quick answer!
 * I have found the solution in the AddIndexFieldToSubmissions class as mentioned
   at the link you have sent me.
 * I just changed the function in my needs and now I have the desired results.
 * I will post an example lately in order to help people that may have the say question.
 *  Thread Starter [latsi008](https://wordpress.org/support/users/latsi008/)
 * (@latsi008)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758711)
 * One more thing. I would like to purchase the edit mode plugin. Is the plugin 
   compatible with shortcodes trans and filter options?
 * Thanks again.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758733)
 * Edit mode is available for [cfdb-datatable] only. If you use transforms then 
   you will probably break the connection to the raw data and editing is likely 
   to not work. It will work with filter options.
 *  Thread Starter [latsi008](https://wordpress.org/support/users/latsi008/)
 * (@latsi008)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758760)
 * Thank you! That will do!
 * I have one more question.
    In the filter option of the shortcode i can’t use 
   the following three characters /)(
 * I don’t want to use them as metachars, they are just simple chars.
 * below is an example. The filter option return nothing because of the chars in
   bolds.
    **(**Accountant**/**2014**)**
 * here is the complete code
    $content = ‘[cfdb-datatable form=”cv-form” id=”cf2dbtable”
   trans=”AddIndexFieldToSubmissions” filter=”desired-working-position~~/.*(Accountant/
   2014).*/”]’;
 * echo do_shortcode( $content );
 * Any ideas how to make it work?
 * Thank you in advance!
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758763)
 * Try: use # instead of / to enclose the expression, use backslash to escape parentheses.
 * filter=”desired-working-position~~#.*\(Accountant/2014\).*#”
 *  Thread Starter [latsi008](https://wordpress.org/support/users/latsi008/)
 * (@latsi008)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758769)
 * It worked!
 * Thank you very much for all the help and for your support!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘shortcode complex filter option (nested operators)’ is closed to new 
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

## Tags

 * [complex](https://wordpress.org/support/topic-tag/complex/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 7 replies
 * 2 participants
 * Last reply from: [latsi008](https://wordpress.org/support/users/latsi008/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/shortcode-complex-filter-option-nested-operators/#post-5758769)
 * Status: resolved