Error with filter

4 years 9 months ago #312980 by Totoweb
Error with filter was created by Totoweb
Hi,

We have an error with our filter.

When we only select "Figurant", the users who have "Edelfigurant" in their profile is also shown.

Is this because the word Figurant is also in Edelfigurant?

Any thoughts on how to fix this?

Kind regards.

Please Log in to join the conversation.

4 years 9 months ago #312988 by krileon
Replied by krileon on topic Error with filter
Filter where? Please be more specific as to what your issue is. I also don't know what "Figurant" or "Edelfigurant" is, sorry.


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.

4 years 9 months ago #313013 by Totoweb
Replied by Totoweb on topic Error with filter
Hi,

On our user overview page on the front end we have a filter so that producers can find an actor based on what they have filled in on their profile.

Figurant and Edelfigurant are just 2 checkboxes on what kind of actor they are (see screenshot).

But the problem however is that when they select figurant, edelfigurant will show up as well on the result page.

Kind regards.
Attachments:

Please Log in to join the conversation.

4 years 9 months ago #313018 by krileon
Replied by krileon on topic Error with filter

But the problem however is that when they select figurant, edelfigurant will show up as well on the result page.

edelfigurant contains figurant. That's going to be a problem for searching as in most cases it will use LIKE in the SQL with a wildcard. Especially for multi-checkbox or multi-select fields since they're stored as VALUE_1|*|VALUE_2 in the database. You need to be sure to always use a generic Value that is separate from the Label when configuring your select fields. Example as follows.

Valid Select Options
Value: Opt_1
Label: figurant
Value: Opt_2
Label: edelfigurant

Invalid Select Options
Value: figurant
Value: edelfigurant

The second usage will cause issues. The stored and displayed value are one in the same. Any LIKE based SQL searching will cause the first option to return also the second option because the second option contains the value of the first option. The first usage does not have this problem since the stored values (not seen by the user) are generic, but you can still hit issues with this if not careful (e.g. Opt_1 is within Opt_10). This only impacts fields that allow selecting multiple values (e.g. multi-select or multi-checkbox).


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.

4 years 9 months ago #313041 by Totoweb
Replied by Totoweb on topic Error with filter
Hi,

Thank you for the response.

It is an already existing website with quite a few users. Is it possible to change this without have to go into every user and tick the "Edelfigurant" checkbox?

I am testing it on a subdomain but when i change the Value of "Edelfigurant" to Opt_1 it is not automatically changed in the user profiles so i have to go into the profile and tick the box again.

Kind regards

Please Log in to join the conversation.

4 years 9 months ago #313049 by krileon
Replied by krileon on topic Error with filter
Changing the value will not automatically change it for every user. You'd have to manually fix that within your database. Example of how to best do that using SQL.

UPDATE `jos_comprofiler` SET `FIELD_NAME` = REPLACE( REPLACE( `FIELD_NAME`, 'Edelfigurant', 'Opt_02' ), 'Figurant', 'Opt_01' )

Replace jos_ with whatever your database prefix is and replace FIELD_NAME with your fields name (e.g. cb_myfield). Be sure to make a backup before doing this. The above will first replace Edelfigurant with Opt_02 then replace Figurant with Opt_01. You can change the Opt_02 and Opt_01 to whatever you like as they're just examples.


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.325 seconds