Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

Decimal and calculation

  • jeromm
  • jeromm
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
8 years 5 days ago #290367 by jeromm
Decimal and calculation was created by jeromm
Hello,

I would like to do an automatic calculation with decimals:
Example:
Cb_number1 + cb_number2 = cb_number3
0.001 + 0.002 = 0.003
I do not know if this is the right method, I have the addon Query field
I wrote: SELECT (`cb_number` +` cb_number2`) FROM `#__ comprofiler` WHERE` id` = '[cb_number3]' in the section "CB QUERY Fied"
It does not work
Thank you for your help
Jérôme

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48711
  • Thanks: 8320
  • Karma: 1447
8 years 5 days ago #290395 by krileon
Replied by krileon on topic Decimal and calculation
Doesn't work because id is the user_id of the user in _comprofiler. You need to check `id` = '[user_id]' and in your select add number 1 and 2 together. Example as follows.

Code:
SELECT ( `cb_number1` + `cb_number2` ) FROM `#__comprofiler` WHERE `id` = '[user_id]'

cb_number 3 would just be your 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.

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

  • jeromm
  • jeromm
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
8 years 13 hours ago #290585 by jeromm
Replied by jeromm on topic Decimal and calculation
Merci ça fonctionne !

Et pour utiliser les décimales ? y-a-t'il une solution ?
Merci
Jérôme

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48711
  • Thanks: 8320
  • Karma: 1447
8 years 8 hours ago #290608 by krileon
Replied by krileon on topic Decimal and calculation
It should use decimals assuming your values are stored with decimals as it's just adding the 2 values together. If you're using an integer field you can't have decimals. It needs to be a text or float field and since we've no float field types you'll need to use a text 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: jeromm

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

Moderators: beatnantkrileon
Powered by Kunena Forum