Jump to content

How to run calculations in a workflow


Recommended Posts

Here is 2 examples... If you don't want to do some scripting, the first example could be great to easily add a formula by modifying the "Arg and Vars" object (can duplicate to make more math functions). The second one is nicer if you prefer to have a direct feedback on the number you input

 

https://nofile.io/f/vucR6c28GJq/Calculation+in+Workflow+Example.alfredworkflow

 

Best!

Link to post

Here it is:  https://nofile.io/f/mPGnUHXWJVJ/Calculation+in+Workflow+Example.alfredworkflow

 

About commenting, we can't round to decimal using the builtin Alfred calculator since it rounds to the nearest integer. So, the trick for the first version is to multiply the result by 100 so we move the 2 decimals out and then round the value and divide back by 100.

 

round(({query}+({query}/0.971))*100)/100

 

For the second version, there's a builtin function in python to round a value and there's a second argument to specify the precision that we want, so 2 in this case

 

Hope this helps!

Link to post
  • 2 years later...
On 8/23/2017 at 4:55 PM, GuiB said:

Here is 2 examples... If you don't want to do some scripting, the first example could be great to easily add a formula by modifying the "Arg and Vars" object (can duplicate to make more math functions). The second one is nicer if you prefer to have a direct feedback on the number you input

 

https://nofile.io/f/vucR6c28GJq/Calculation+in+Workflow+Example.alfredworkflow

 

Best!

 

Can you please show a screenshot where exactly to add the math formula to "Arg and Vars" as the link is dead? 

Edited by slyfox
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...