I’m creating a two-step action to prompt for the name of a grocery store and insert it into a draft. The draft is then appended to a Dropbox file for use with ledger-cli.
The problem is that the result differs between macOS and iOS. Here’s the action:
Step 1:
// Prompt for name of grocery store
var store = Prompt.create();
store.title = "Groceries transaction";
store.message = "Choose a grocery store";
var options = ["Whole Foods", "Stop and Shop", "Big Y"];
var selectedOptions = ["Whole Foods"];
store.addSelect("s1", "Select one...", options, selectedOptions, false);
store.addButton("OK");
if (store.show()) {
var s = "Selected: " + store.fieldValues["s1"] + "\n\n";
alert(s);
draft.setTemplateTag("store_name", store.fieldValues["s1"]);
}
Step 2:
[[date]] [[store_name]]
PSK:Expenses:Food:Groceries
PSK:Assets:Checking:MTB-PSK
On macOS (13.1), the variable ‘store_name’ is inserted correctly, for example:
2024-02-08 Whole Foods
PSK:Expenses:Food:Groceries
PSK:Assets:Checking:MTB-PSK
On iOS (15.8), it’s not inserted, and I get:
2024-02-08 [[store_name]]
PSK:Expenses:Food:Groceries
PSK:Assets:Checking:MTB-PSK
Thank you for any help. First time creating an action and using Javascript, so probably operator error.
Pete