Skip to Content Skip to Menu

[SOLVED] Error is display list with regex

  • comyoo
  • comyoo
  • OFFLINE
  • Posts: 87
  • Thanks: 1
  • Karma: 0
10 years 8 months ago #241803 by comyoo
Replied by comyoo on topic Error is display list with regex
Hi,

The solution what we needed is this;

We have 7000 users. And many of them are in 'teams', because the have had a weekend with a team. So we give them numbers like 301, 302 etc. And for example 301 are 10 people, but someone can be also in 2 or more teams.
We use numbers like 301, but also 'staf' members so we are able to give them more access to some pages or management info.

How can we do this in a good way trought CB?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 8 months ago - 10 years 8 months ago #241832 by krileon
Replied by krileon on topic Error is display list with regex
You can't, because there is no SQL function to handle your situation. Normally you'd use REGEXP, but you allow the field to be empty in some situations and you can't have an empty REGEXP in SQL as it will fatally error the SQL. The best way to do this is to not filter the userlist at all and just have the field searchable so the user can search whatever team they want. There maybe an SQL function to handle this though, but beyond REGEXP usage I'm not aware of one. You're welcome to check in the below MYSQL documentation though.

dev.mysql.com/doc/refman/5.6/en/func-op-summary-ref.html

It's relatively simply to check for a single value in a list of values as shown earlier, but checking for a list of values in a list of values becomes a lot more complicated for SQL; especially if either side of the operator can be empty.

I'm not entirely sure the below will work, but it maybe worth a shot. Idea is to condition the filter entirely.

Code:
[cb:if cb_team!=""]`cb_teams` REGEXP REPLACE( '[cb_teams]', '|*|', '|' )[/cb:if]

Note the above assumes your field is a select field so it replaces |*| with REGEXP "or" usage of |.


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.
Last edit: 10 years 8 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • comyoo
  • comyoo
  • OFFLINE
  • Posts: 87
  • Thanks: 1
  • Karma: 0
10 years 8 months ago #241837 by comyoo
Replied by comyoo on topic Error is display list with regex
Hi,

Thank for your reply. Your suggestion does not work.

But how can we create a whole new other system of tagging people into teams and let them only see some contactinfo from the members of the same team? And with this they are also in a certain group according to their teamnumber.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 8 months ago #241838 by krileon
Replied by krileon on topic Error is display list with regex
Just tried the below in SQL and I think it might work for your usage.

Code:
`cb_teams` REGEXP IF( '[cb_teams]' != '', REPLACE( '[cb_teams]', '|*|', '|' ), 'NOVALUE' );

Basically what it does is if the users cb_teams field has a value it'll do the REPLACE and try to match all users using REGEXP. If cb_teams field has no value it trys to match REGEXP with the string NOVALUE, which will always fail resulting in no users displayed.

Please give the above two solutions a try and see if either will fit your needs.


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.
The following user(s) said Thank You: comyoo

Please Log in or Create an account to join the conversation.

  • comyoo
  • comyoo
  • OFFLINE
  • Posts: 87
  • Thanks: 1
  • Karma: 0
10 years 8 months ago #241889 by comyoo
Replied by comyoo on topic Error is display list with regex
The last one works; Thank you very much!

Please Log in or Create an account to join the conversation.

  • comyoo
  • comyoo
  • OFFLINE
  • Posts: 87
  • Thanks: 1
  • Karma: 0
9 years 6 months ago #263217 by comyoo
Replied by comyoo on topic Error is display list with regex
Hi Krileon,

This solution is working, but now we have a small 'problem'.

We have team 320 and team 20
People from 320 see also people of team 20.

Can we be more specific with the query so only exact teamnumbers are searched on?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum