I’m running into a snag trying to setup a personal automation that does the following:
When I tap on Wallet passes or payment card
Do Receive transaction as input (from Wallet)
Into Dictionary with KeysMerchant, Name, Amount, Card
Look up Merchant against a list of names in one of three lists (Fixed, Needs, or Wants)
If found in one of the lists, set variable Type to list name (Fixed, Needs, or Wants)
Get Current Date (set format to ISO 8601)
Combine in Text as Date,Merchant,$Amount,Type
Append Text to Folder; File Path: P+L_Tracker.csv; Make New Line checked
Here’s the issue, I can get #1, #2 and #3 to work, when done in the Automation under the When and Do; but I don’t want to do #2…#8 done in the Automation; but via a Shortcut. What I cannot figure is, how to run the shortcut to accept into the Dictionary in the Shortcut, the Input from the Automation, as I need to specify the Dictionary Key’s Value based on the Automation Input that’s not visible to the Shortcut, if that makes sense (or do I just need to set the Variable to the Dictionary in the Automation Do part, and call it from inside the separate Shortcut, via a get Variable?
Other than that, the Lists are for Fixed, Needs, or Wants that break down to: Fixed - Mortgage, Rent, Auto Insurance, Hydro… Needs - Groceries, Medication, etc. Wants - Cafe, Restaurant, Clothing, Books…
And how to I look those up; I was planning to use an If statement; but that’s not going to do it (I think). What I was thinking was:
Check If
Merchant is in List Fixed set variable to Fixed; else
Merchant is in List Needs set variable to Needs; else
Merchant is in List Wants set variable to Wants; else
OtherwiseNothing
Set Variable Type from above nested If statement
At this point combine into #7 earlier:
7. Combine in Text as Date,Merchant,$Amount,Type
I’ve worked parts of this up in various separate scripts; but the noted issues are what drive me batty. Any help would be appreciated and I’ll provide snippets of my work, as I can get them.
Yes (or use the magic variable so you don’t have to assign a separate variable name) and then use the Run Shortcut action to call your Shortcut; tap on the arrow and you can select the input for the Shortcut. The display of the action seems a bit broken in the latest iOS as it doesn’t show the selected input until you tap at the right of the input message.
I have revised things and though it sorta works now, in a way, the Automation is only kicking off the process and the Dictionary therein is not capturing the data nor passing it along. As such and looking at other Automations, I have done the following:
Note: I think the TransID key pulling the Transaction value, will be unneeded.
From here, I have also updated the Shortcut (link below) and am hoping this will work. I included the testoutput.csv file, to make sure that when the automation runs, I can see (looking back) if the input is properly captured. If so, I suspect the issue then will be the Shortcut and how it is setup.
I have it setup now that the Automation passed all the data through, except the Amount data isn’t coming through. I have tested is by changing the Type from Number to Text and neither is bringing the data through; though the value was successfully being pasted from the Automation to a csv file in either case. On the Shortcut side, I have made sure the Amount Dictionary Key is set to the same as the Automation Dictionary Key was set at the same time and still no luck. Any ideas?
The Red text reads "This is setup as Text Type presently. I have also used Number Type previously, one I knew the rest of the data was getting through. Still no luck.
An update for anyone interested in this Shortcut; I have restored the Dictionary data being passed from the Personal Automation to the Shortcut, with the Merchant and Date detail making it through; but the Amount data is still showing as 0. I was able to have the Automation print the details to a text file and it showed the Amount data was fine at that point. I have removed that function from the Automation; but now have added it into the Shortcut, immediately between the Set Variable action and the Dictionary; the function is two actions, the first a Text action that gets the TransActionDictionary value and pastes it into the text field, the second then saves this to a new file called Purchase_Tracker.txt. This way, it will be pasted into that text file, and I can see if the Amount data is at least, carried over from the Personal Automation. If it is, I know it is in either the Dictionary Key/Type/Value for the Amount data that there’s something wrong or in the further down Text action that is used to pasted the various Variables and such, into the final Purchase_Tracker.csv file.
If anyone reading this has suggestions/insight, I would appreciate it.
I have done that and all the data, except the actual Amount value, comes through. The Merchant is passed correctly; but the Amount value comes through as $0. As per the attached, you can see that the Dictionary in the Automation, has the Amount Key with the Value set as noted. It appears to be correct and should be passing through; but isn’t. I have tried to different “Add new item” types, Text and Number; both fail to pass through any dollar value, except 0. I do have a part of the automation that prints the Dictionary values to a Text action, then saves it to a Text file. That works; but I want most of the work to be in a Shortcut, so that it can be save outside Shortcuts when I do a weekly backup, incase I have to rebuild or share the shortcut with family.
Or should I give up that idea and just put it all into the Automation? But then, it is device specific, which defeats the idea I had in the first place.