Add decimal values

Hello community
I don’t understand how to add decimal values. My query seems correct because the addition result is exact for integer values. But as soon as I add a decimal place, whether with a comma or a period, the result is strange
Thanks for your help

- Achat de fournitures
  montant:: 15
- Déjeuner d'affaires
  montant:: 20
- Frais de transport
  query-table:: false
  montant:: 10
:title "Somme des Montants"
:query [:find (sum ?v)
        [?b :block/properties ?p]
        [(get ?p :montant) ?v]]


1 Like

Welcome. That is a tricky problem. Try this:

{:title "Somme des Montants"
 :query [:find (sum ?v)
   :with ?b                  ; prevent identical values from counting only once
   [?b :block/properties ?p]
   [(get ?p :montant) ?m]
   [(* 1 ?m) ?v]             ; convert ?m to actual number

Pay attention to the two comments.


thank you very much @mentaloid ,
you’ve solved my problem for the example i gave. but my project is to enter the property ::km (for mileage) in the daily journal note. I’d like to calculate my mileage allowance at the end of the year. The query doesn’t seem to work for this use but I can’t figure out how to modify it… Maybe because I don’t know anything about coding… :sweat_smile:

@mentaloid don’t take my message into account, I’ve solved the problem by putting a period instead of a comma in my values. The problem has been solved, and thank you for your quick response.
excellent week