Add two values ​​inside variables TASKER

336 views
Skip to first unread message

Genios Marketing

unread,
Sep 14, 2022, 1:02:45 PM9/14/22
to Tasker
Hello. I have a problem that I cannot add two numbers, can someone help me? The data to sumer comes from WhatsApp. The client writes that he wants a Cake for 309.00 and wants to add a photo of 100.00 I have the data stored in %Price %Photo 
 I want to sum those 2 values, in JavascriptLet. 
var price = parseFloat("%Price"); 
var photo = parseFloat("%Photo"); 
var total = price + photo;
Then I visualize the result in a Flash "hello, price of the cake is %total" 

and the result it shows me is: "hello, price of the cake is nan
I would like someone to guide me and be able to generate the correct result.


best regards


Jay M

unread,
Sep 14, 2022, 6:15:28 PM9/14/22
to tas...@googlegroups.com
Im assuming %Price and %Photo were created in Tasker and not somewhere in the JS? if so they need to be accessed with global()

Untested

var price = parseFloat(global("%Price")); 
var photo = parseFloat(global("%Photo")); 
var total = price + photo;
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/d4a5c2c4-633d-42f5-a035-c02f7e400b3an%40googlegroups.com.
Message has been deleted

Genios Marketing

unread,
Sep 15, 2022, 5:14:49 PM9/15/22
to Tasker
It saves all the information but it does not calculate the total.
Run the JavaScript Let function as you indicate and it does not generate the result.

1.png2.png3.png4.png

Jay M

unread,
Sep 15, 2022, 6:24:20 PM9/15/22
to tas...@googlegroups.com
I cant read the language so im not sure what im looking at. I cant see %Photo in use anywhere, i do see %Foto though so maybe it was just a typo and you were supposed to use %Foto in the JS? 

Anyways i just tested the code i wrote by creating the 2 variables in Tasker and adding them together in the JS  and it works for me see screenshot.



On Thu, 15 Sept 2022, 22:09 Genios Marketing, <geniosma...@gmail.com> wrote:
It doesn't work for me yet... I send you a screenshot where I save the data, and a field of the tasker function


El miércoles, 14 de septiembre de 2022 a las 16:15:28 UTC-6, Jay M escribió:
Screenshot_20220915-231611_Tasker.png

Genios Marketing

unread,
Sep 16, 2022, 5:18:33 PM9/16/22
to Tasker
works when a numeric value is assigned to the variable. But in my case I receive the data from WhatsApp in the variable %message
  •  I receive all the data from WhatsApp, then process and mutresta them in the Variables assigned in Tasker
    • 1. Set the Variable %posicion to position the WhatsApp number that writes to me and not generate conflicts when 2 clients write at the same time
    • 2.   I make use of Si (if) to condition the data that comes from WhatsApp and assign them the variables

    • grafico.png
Message has been deleted

victor. nunez.

unread,
Oct 30, 2022, 1:48:10 AM10/30/22
to Tasker
How can I assign an ID to each RUT or DNI that is saved?

El domingo, 30 de octubre de 2022 a la(s) 02:34:03 UTC-3, victor. nunez. escribió:
Buenissimo, como puedo aprender mas de ti?

Manuel Morris

unread,
Oct 31, 2022, 8:30:29 AM10/31/22
to tas...@googlegroups.com

On Sun, Oct 30, 2022, 1:34 AM victor. nunez. <victor.nu...@gmail.com> wrote:
Buenissimo, como puedo aprender mas de ti?

El viernes, 16 de septiembre de 2022 a la(s) 18:18:33 UTC-3, geniosma...@gmail.com escribió:
Reply all
Reply to author
Forward
0 new messages