JolinM Posted March 1, 2014 Share Posted March 1, 2014 Hi, I’m trying to put a script together to do the math for my taxes calculation. I could do a Numbers spreadsheet, but I love the idea to have it at my fingertips. Here is the current workflow. The top one works great, but will not produce any output when I input numbers with comma (600,50) or point (600.50). I was trying to build the bottom one as a script filter, but I lacks some knowledge to pursue that further. Thanks for having a look at it! Link to comment
vitor Posted March 1, 2014 Share Posted March 1, 2014 (edited) The top one isn’t producing any output when you input a value with decimals because you’re setting it as an integer (a whole number). The solve it, simply change input = int("{query}") to input = float("{query}").For the second case, when creating a new workflow, instead of choosing Blank Workflow, pick Examples → Script Filter XML format, to see how it should be structured. There are also some python modules to help with that (there are more that you can find on the forums and github). Those examples are well documented, so you should take a look at them first. If you encounter difficulties, feel free to ask about them, as this community is very receptive to questions. Edited March 1, 2014 by Vítor Link to comment
JolinM Posted March 4, 2014 Author Share Posted March 4, 2014 Thanks for the answers. I already fixed in part the first one. It is now working with (9.55) but still doesn't want any comma (9,55). I’ll investigate on the second one. Link to comment
vitor Posted March 5, 2014 Share Posted March 5, 2014 Using “.” is the correct syntax. However, if you really want to use “,” as a decimal separator, what you can do is change the same line mentioned above to input = float("{query}".replace(',','.')); this way “,” will be replaced by “.” when present, and the rest of the script can continue to function as usual. Link to comment
JolinM Posted March 5, 2014 Author Share Posted March 5, 2014 Woa, that is great! I’m French canadian, so the correct syntax is actually using "," for my region. Thanks for that tricks; I’ll note it for futur use as well! Stay tuned for the second one. Link to comment
martinmenge Posted January 23, 2018 Share Posted January 23, 2018 Hi, I know this is an old topic, but I'm trying to achieve something which may have the same mechanics (working out arbitrage based on a specific exchange rate). Is the source files of this workflow still available somewhere? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now