Skip to Content Skip to Menu

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

Can you concatenate two community builder fields on display

  • cfcoder
  • cfcoder
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
8 years 4 months ago #282230 by cfcoder
Hey, I am working on creating my User profile page and I would like to concatenate two fields when displaying on the profile. For example: Address to concatenate City and State
and height in ft and inches to concatenate. Is this possible?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago #282243 by krileon
Yes, substitute them together in a Custom HTML field or using the Layout parameters of at least one of them. See the below for substitution usage information.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb

See the below for Custom HTML and Layout usage information.




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.

  • cfcoder
  • cfcoder
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
8 years 4 months ago #282337 by cfcoder
OK, next question. I have a created a couple of fields for height in feet and inches and I want to concatenate liket this:
[cb_profile_height_ft] Feet, [cb_profile_height_inches] inches

But if there isn't anything entered yet I see the display code. How do test if a value is blank? I tried:
[cb:if cb_profile_height_inches !=" "][cb_profile_height_inches inches[/cb:if]
But that doesn't work.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago #282383 by krileon
Your IF condition won't work because it's not properly formatted. Please see the below substitution tutorial.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb

Note the formatting is not open to interpretation. Do not add extra spaces if it does not show a space in any of the examples as the REGEXP will not match it. Example as follows.

[cb:if cb_profile_height_inches!=""], [cb_profile_height_inches] inches[/cb:if]

If it's an integer field then you'll likely want to use the below usage.

[cb:if cb_profile_height_inches>"0"], [cb_profile_height_inches] inches[/cb:if]


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.

Moderators: beatnantkrileon
Powered by Kunena Forum