Catching Intents and Variables

pspeirs

New member
Hi,
I'm catching Intents messages from the torque app and want to take conditional actions depending on the values of the messages coming in.

For Triggers I have an Intent Received to catch the message, but I cannot seem to assign the value to a previously created global variable of type decimal. I can only assign the value to a variable I create in the Intent Received section. I can call it a global variable however it will be saved as a string and not a decimal. Nor can I see a way to change it.

So, the question is, how do I run an If-Else Action if I'm looking for a value > 13 for example.

Could I potentially save the message value to a local variable, then under the Actions, set a global variable (decimal) with the value of the local variable (string). Will Macrodroid do the conversion needed?

I could then do a less than/greater than condition.
 
Last edited:

420

Active member
Hi,
I'm catching Intents messages from the torque app and want to take conditional actions depending on the values of the messages coming in.

For Triggers I have an Intent Received to catch the message, but I cannot seem to assign the value to a previously created global variable of type decimal. I can only assign the value to a variable I create in the Intent Received section. I can call it a global variable however it will be saved as a string and not a decimal. Nor can I see a way to change it.

So, the question is, how do I run an If-Else Action if I'm looking for a value > 13 for example.

Could I potentially save the message value to a local variable, then under the Actions, set a global variable (decimal) with the value of the local variable (string). Will Macrodroid do the conversion needed?

I could then do a less than/greater than condition.
yes, you just save the string variable value to a decimal variable, by adding an action to set your decimal variable to - expression - click the 3 dots - choose string variable value, and then pick your string variable.

i'm not sure but you might have to use text manipulation - extract text/substring first to extract only the numbers and remove the letters.
 

pspeirs

New member
Hi,
Yeah, I played around with it a bit more and that's exactly what I ended up doing. Seems to work well on the simulator. I did have to create a bool flag to set so I didn't continually generate messages, but all good.
 
  • Like
Reactions: 420
Top