[SOLVED] Working with Query values

6 years 8 months ago - 6 years 8 months ago #296423 by cliffvt
[SOLVED] Working with Query values was created by cliffvt
Guys please can you give me some advice - i have two query fields and I want to create another field that takes the value of those two fields and adds them together and displays the result read-only on profile edit.

As the [value] from the query is not stored anywhere how do you suggest i do it. I am not a very good coder or php expert so if you could perhaps suggest how to store the [value] that would be great so i can get at it.

So currently I have
Query field 1 : SELECT ( `cb_uktfrpaxout` * 10 ) FROM `#__comprofiler` WHERE `id` = '[user_id]'
Query field 2 : SELECT ( `cb_uktfrpaxin` * 10 ) FROM `#__comprofiler` WHERE `id` = '[user_id]'
Now I want to add the two values together and display it

Perhaps there is a better way of achieveing this?

Cheers

Cliff

Please Log in to join the conversation.

6 years 8 months ago #296429 by krileon
Replied by krileon on topic Working with Query values
You want the value of those 2 query fields combined? Should be able to do that using a 3rd query field that combines their selects. See the below example based off the queries provided above.

SELECT ( ( `cb_uktfrpaxout` * 10 ) + ( `cb_uktfrpaxin` * 10 ) ) FROM `#__comprofiler` WHERE `id` = '[user_id]'

Query field should be able to display on profile edit as well assuming you've it set to do so within CB > Field Management and have latest build of CB Query Field.


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: cliffvt, wbuk

Please Log in to join the conversation.

6 years 8 months ago #296431 by cliffvt
Replied by cliffvt on topic Working with Query values
Perfect thanks!
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.192 seconds

Facebook Twitter LinkedIn