Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] parameters in field substitution

  • startup
  • startup
  • OFFLINE
  • Posts: 113
  • Thanks: 7
  • Karma: 1
  • Add-ons
9 years 9 months ago - 9 years 8 months ago #260828 by startup
Hello,

I have a CB field birthday of type 'date'. I have configured the display of this field to be shown as 'age' (as in years) (rather than date) via CB backend.

Now, I have another field which concatenates amongst other fields, also this birthday field. However, when using [birthday], then it shows it in format date.

Question: is there any way I can have the field substitution show it in format age (as in years) instead of date?

Thank you!
Last edit: 9 years 8 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
9 years 9 months ago #260837 by krileon
Replied by krileon on topic parameters in field substitution
Please see the below substitution tutorial.

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

You are substituting in the raw value and not the formatted value. You need to use [cb:userfield field="FIELD_NAME" /] usage.


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.

  • startup
  • startup
  • OFFLINE
  • Posts: 113
  • Thanks: 7
  • Karma: 1
  • Add-ons
9 years 9 months ago #261067 by startup
Replied by startup on topic parameters in field substitution
Hello Krileon,

Thank you for the link to the substitution tutorial. I read it a few times, studied the examples and followed the advise of 'There are many more possibilities. It's just a matter of trial and error to see what works for you.'

I must admit after many trials, I still get only errors :( May I ask for help with my very concrete example here?

I have a field cb_birthday of type Date, which contains the user's birthdate in format YYYY-MM-DD. The field has a parameter 'Profile View Display' in the parameters tab. One can choose, for example, 'age' or 'Timeago, with ago' etc.

I now want to create another field, where I'd like to concatenate another field value with the bday in age (i.e., years old) and not DDDD-MM-YY via substitution.

I just don't get how I can pass the display choice 'age' to the field cb_birhtday :(

I tried

[cb:cb_birthday format="Age" /]
[cb:userdata field="cb_birthday" format="Age" /]
[cb:userdata field="cb_birthday" ProvileViewDisplay="Age" /] (I know, quite desperate this last one)

and more variations than I can remember :( unfortunately, none worked...


I also found this two year old thread licenses.joomlapolis.com/forum/153-professional-member-support/218602-solved-how-to-have-more-information-about-http-error-500?limitstart=0

wheresome said using cb:userfield instead of cb:userdata did the trick. But when I do this now, I either get yyyy-mm-dd or nothing and not, for example, '35 years'.


Would really appreciate the solution for what is the correct syntax to pass the parameter to display as Age to the substitution of a Date field.

Thank you so much!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
9 years 9 months ago #261153 by krileon
Replied by krileon on topic parameters in field substitution

I just don't get how I can pass the display choice 'age' to the field cb_birhtday

You can't, no such feature exists. If it existed it'd be documented in the tutorial. If it's not in the tutorial it can't be done. All the available substitution parameters are noted in the tutorial.

For your date field to display as age you need to edit it within CB > Field Management and set it to age display. Once done you need to substitute in the formatted value of the field using [cb:userfield field="FIELD_NAME" /].

If nothing displays when substituting in the formatted field then the field is not accessible to the user. Formatted output respects privacy, access permissions, etc..


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.

  • startup
  • startup
  • OFFLINE
  • Posts: 113
  • Thanks: 7
  • Karma: 1
  • Add-ons
9 years 8 months ago #261603 by startup
Replied by startup on topic parameters in field substitution
Thank you!
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum