[SOLVED] Mathematical Calculation Fields

11 years 5 months ago #214145 by edmundcheong
Replied by edmundcheong on topic Re: Mathematical Calculation Fields

krileon wrote:
[cb:if cb_query>="30"]You appear to be over weight![/cb:if]


Thank you so much for the help! Just one more question. What if there are more then 1 conditions? How do I include them? For example:

if cb_gender="mail" and if cb_query>="30"

Please Log in to join the conversation.

11 years 5 months ago #214184 by krileon
Replied by krileon on topic Re: Mathematical Calculation Fields

Thank you so much for the help! Just one more question. What if there are more then 1 conditions? How do I include them? For example:

You can use "and" or "or" to add more conditions if needed. Examples as follows.

[cb:if cb_gender="male" and cb_query>="30"]You appear to be over weight![/cb:if]

[cb:if cb_query>="30" or cb_query>="50"]You appear to be over weight![/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: edmundcheong

Please Log in to join the conversation.

11 years 5 months ago #214447 by edmundcheong
Replied by edmundcheong on topic Re: Mathematical Calculation Fields
Thanks!

Please Log in to join the conversation.

11 years 5 months ago #214825 by edmundcheong
Replied by edmundcheong on topic Re: Mathematical Calculation Fields
One question, how do i run the query and store the value of the result to a CB field? For example store to cb_permanentBMI

Please Log in to join the conversation.

11 years 5 months ago #214847 by krileon
Replied by krileon on topic Re: Mathematical Calculation Fields
CB Query Fields don't store anywhere. They query the database and display the results of said query. If you want to store it to a field you can use CB Auto Actions with a field action or a query action.


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 to join the conversation.

11 years 5 months ago #214988 by edmundcheong
Replied by edmundcheong on topic Re: Mathematical Calculation Fields

krileon wrote: CB Query Fields don't store anywhere. They query the database and display the results of said query. If you want to store it to a field you can use CB Auto Actions with a field action or a query action.


I have tried using the Auto Action to get the BMI query field which has the following:
SELECT ( `cb_weight` / ( `cb_height` * `cb_height` ) ) FROM `#__comprofiler` WHERE `id` = '[user_id]'

But somehow it is not populating the field. I am using auto action to copy the query field above and copy it to cb_bmi.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.256 seconds

Facebook Twitter LinkedIn