Skip to Content Skip to Menu

Fields AutoSum

  • buyalong
  • buyalong
  • OFFLINE
  • Posts: 52
  • Thanks: 1
  • Karma: 0
12 years 6 months ago #195995 by buyalong
Fields AutoSum was created by buyalong
Hi Kri,

Is there a way to get the sum of certain fields?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48441
  • Thanks: 8275
  • Karma: 1443
12 years 6 months ago #196007 by krileon
Replied by krileon on topic Re: Fields AutoSum
You could use CB Query Field to query the provide a SELECT query to combine the fields values. Example as follows.
Code:
SELECT ( `cb_field1` + `cb_field2` ) FROM `#__comprofiler` WHERE `id` = [user_id]


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.

  • buyalong
  • buyalong
  • OFFLINE
  • Posts: 52
  • Thanks: 1
  • Karma: 0
12 years 6 months ago #196086 by buyalong
Replied by buyalong on topic Re: Fields AutoSum
How would it look if I have like 5 different fields to add up?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48441
  • Thanks: 8275
  • Karma: 1443
12 years 6 months ago #196089 by krileon
Replied by krileon on topic Re: Fields AutoSum
Adjust the select query to have as many fields you want added together. See above for example query that adds 2 fields together, simply add more + `cb_field` to it.


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: buyalong

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

  • buyalong
  • buyalong
  • OFFLINE
  • Posts: 52
  • Thanks: 1
  • Karma: 0
12 years 6 months ago #196090 by buyalong
Replied by buyalong on topic Re: Fields AutoSum
Is there a way to assign a specific value to each field? In that case when a subscriber enters into a field that they will use X units of service A and so on, I will get a total of all of the services they will use.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48441
  • Thanks: 8275
  • Karma: 1443
12 years 6 months ago #196093 by krileon
Replied by krileon on topic Re: Fields AutoSum
Dynamically? No, not without a new fieldtype to do exactly that. You maybe able to use a Code action with jQuery Method to update an already existing field using jQuery to add together other fields, but it's a rather advanced method and impossible if you've no jQuery experience (please understand me providing you a possibility does not mean I can write this for you).

The CB Query Field method would only provide the totals after the page had been refreshed and values stored to database.


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: buyalong

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

Moderators: beatnantkrileon
Powered by Kunena Forum