[SOLVED] List filters and empty or null fields

9 years 8 months ago #248433 by pasquale1980
Replied by pasquale1980 on topic List filters and empty or null fields
I need the second option, because the field2 can be also empty. Inserting the string:

( ( `cb_field1` LIKE '%[cb_field2]%' ) OR ( '[cb_field2]' = '' ) )

if the field2 is populated and finds correspondence with the field1, gives me the correct users, if it does not find the correspondence returns nothing. The problem occurs when the field2 is empty because it returns all the data, seems that the part " OR ( '[cb_field2]' = '' ) " is not performed.

Please Log in to join the conversation.

9 years 8 months ago #248490 by krileon
Replied by krileon on topic List filters and empty or null fields
It's checking if cb_field2 of the viewing user is empty. If cb_field2 of the viewing user is empty or cb_field1 contains cb_field2 then show the user being parsed. So if cb_field2 of the viewing user is empty you'll get a list of all users. If you want it to show nothing when cb_field2 is empty then change the = "" to != "".


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

9 years 8 months ago #248531 by pasquale1980
Replied by pasquale1980 on topic List filters and empty or null fields
I apologize, but I meant to say different and not equal "OR ( '[cb_field2]' <> '' ) )" and not "OR ( '[cb_field2]' = '' ) )".
However, I solved by replacing the LIKE operator with "="

(( `cb_field1` = '[cb_field2]' ) OR ('[cb_field2]' != '')

so data entry is constrained by fixed values ​​contained in the dropdown. Now, however, I would check also that the field1 is different from empty and I set the string:

(( `cb_field1` = '[cb_field2]' ) OR ('[cb_field2]' != '') OR (`cb_field1` != ''))

but it does not work, it is possible to do so?.
Thank you.

Please Log in to join the conversation.

9 years 8 months ago #248540 by pasquale1980
Replied by pasquale1980 on topic List filters and empty or null fields
I solved this way:

( ( ( `cb_field1` = '[cb_field2]' ) OR ( '[cb_field1]' != '' ) ) AND ( '[cb_field2]' != '' ) )

I have done several tests and it seems to work well, I hope it is a valid method.
Thank you.

Please Log in to join the conversation.

9 years 7 months ago #250216 by pasquale1980
Replied by pasquale1980 on topic List filters and empty or null fields
Hi, I installed CB 2.0, everything works fine except the userlist. I saw that I must to add the prefix "eu." for the columns of the tables cb_comprofiler so I changed my string:

( ( ( ue.`cb_field1` = '[cb_field2]' ) OR ( '[cb_field1]' != '' ) ) AND ( '[cb_field2]' != '' ) )

but the filter does not work and I get the message:

"There are no published user lists!"

Please Log in to join the conversation.

9 years 7 months ago #250262 by krileon
Replied by krileon on topic List filters and empty or null fields
Ensure at least 1 of your userlists is marked as default.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.231 seconds

Facebook Twitter LinkedIn