Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

substitutions equal nothing does not work

8 years 9 months ago #276141 by ks.stadler
substitutions equal nothing does not work was created by ks.stadler
If I write this in the substitutions ...

[cb:if cb_my_field=""] test [/cb:if]

... this won't work. But the field is really empty. How can I check if a field is empty?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 9 months ago #276169 by krileon
Replied by krileon on topic substitutions equal nothing does not work
The field probably isn't really empty. Check the _comprofiler database to see its exact value. If it's a checkbox for example the values can only even be 0 or 1 for example. It also depends on where the substitution is being used as it may not be substituting for the user you're expecting.


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 or Create an account to join the conversation.

8 years 9 months ago #276173 by ks.stadler
Replied by ks.stadler on topic substitutions equal nothing does not work
Thanks for your answer.
I have checked the database... and the fields of the users are really empty! The field is a normal textfield. I wrote this for the layout value of the userlist. it is strange, because with this [cb:if cb_my_field=""] test [/cb:if] nothing was shown... even fields which previously displayed a content no longer appears! Why? But when I test it with !="" then the fields which are not empty shows "test"!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 9 months ago #276186 by krileon
Replied by krileon on topic substitutions equal nothing does not work
You're overriding the output of the field and you're only overriding empty output. You need to handle both cases. Example as follows.

[cb:if FIELD_NAME=""]EMPTY[/cb:if]
[cb:if FIELD_NAME!=""][value][/cb:if]

As it's a text field even a space counts as a character and won't be empty. You also need to ensure you're editing the correct layout. Specifically you're probably wanting to edit exclusively the Profile Value Layout.


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 or Create an account to join the conversation.

8 years 9 months ago #276214 by ks.stadler
Replied by ks.stadler on topic substitutions equal nothing does not work
Thanks for your answer. Now I have tested it with a fresh install on xampp. I create a field "cb_field" and at the same time I write
[cb:if cb_field=""]empty[/cb:if]
[cb:if cb_feld!=""][value][/cb:if]

in the Profile Value Layout. So the field is empty for all users at this moment. But the field shows only a "-" in profile view. Because this is the default preference for empty fields in the configuration. That means it does not work :(

Community Builder is the version 2.0.4! Was this a bug in this version? I cant update because I had to much changes in the code!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 9 months ago - 8 years 9 months ago #276268 by krileon
Replied by krileon on topic substitutions equal nothing does not work
I've no idea if it's bugged in 2.0.4, but you're pretty far out of date. What do you mean you changed code? Don't touch core code or you won't be able to update anymore unless you properly manage a GIT repository that'll let you diff and merge your changes correctly. CB Auto Actions makes it so you really should not be touching core code at all.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum