Skip to Content Skip to Menu

query field setup

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago #328260 by krileon
Replied by krileon on topic query field setup
IF substitutions are described in detail at the bottom of the substitution tutorial below.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb

Example as follows.

Code:
[cb:if cb_gender="male"]M[/cb:if] [cb:if cb_gender="female"]F[/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.

  • liaskas
  • liaskas
  • OFFLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
2 years 9 months ago #328262 by liaskas
Replied by liaskas on topic query field setup
Thank you for your reply Krileon

<div>[cb:userfield field="formatname" reason="list" /] [cb:if cb_gender="male"]M[/cb:if] [cb:if cb_gender="female"]F[/cb:if]</div>

returns nothing!

What returns what we need is

[cb:userfield field="formatname" reason="list" /] [cb:userfield field="gender" reason="list" /]

This returns...

[formatname] Male
[formatname] Female
...etc

We need to condition the Male and Female values so that when it is Male to sow just an M and not the whole Male. The cb online module is at the sidebar right position and we do not have much space there.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago - 2 years 9 months ago #328264 by krileon
Replied by krileon on topic query field setup
I've no idea what the name of your gender field is or its values. My example is just that an example. You need to adjust it to fit whatever field behavior you've setup. IF conditions are for example what you're wanting to do. If it really is named "gender" (not sure how you pulled this off? It should be prefixed with cb_) then the below for example would be what you'd use.

Code:
[cb:if gender="Male"]M[/cb:if] [cb:if gender="Female"]F[/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.
Last edit: 2 years 9 months ago by krileon.

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

  • liaskas
  • liaskas
  • OFFLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
2 years 9 months ago #328265 by liaskas
Replied by liaskas on topic query field setup
Thank you for your patience Krileon!

Actualy we are talking about The CB Online module / User-text field

Is there a chance that something like the following might work in CB Online module / User-text field?

[cb:if [cb:userfield field="cb_gender" reason="list" /]="Male"]M[/cb:if] [cb:if [cb:userfield field="cb_gender" reason="list" /]="Female"]F[/cb:if]

Thank you

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 9 months ago #328272 by krileon
Replied by krileon on topic query field setup

Is there a chance that something like the following might work in CB Online module / User-text field?

No, it will work fine there.

[cb:if [cb:userfield field="cb_gender" reason="list" /]="Male"]M[/cb:if] [cb:if [cb:userfield field="cb_gender" reason="list" /]="Female"]F[/cb:if]

That is not a valid substitution syntax. I've given you multiple examples above showing valid syntax as well as the tutorial showing the exact syntax. Based off this information you'd have the below.

Code:
[cb:if cb_gender="Male"]M[/cb:if] [cb:if cb_gender="Female"]F[/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.
The following user(s) said Thank You: liaskas

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

Moderators: beatnantkrileon
Powered by Kunena Forum