Is there a more elegant way to use an input field that only needs part of the selection to be returned? Sorry if terminology is wrong.
I want to be able to select from a list of account numbers to insert into spreadsheets/emails. But I need to reference the description associated with that number.
I currently use an optional field to show the descriptions for reference and then a Pop-Up Menu field with the account numbers that I can reference against. Screenshot below.
Is there a better way to do this?
1 Like
Hi Ryan, as I’m understanding it, you want to expand only the account number, but you need to be able to see the account name. Here are a couple of solutions to try. I’ve created concept Snippets for you in the Community Snippets Public Group. You can copy those to one of your own groups and customize it to your needs.
With Optional Sections
You can try this out by expanding com.accts
.
With this solution, we use optional sections for each account. We use the account name for the name of the optional section, but it only expands the account number.
With JavaScript
You can try this by expanding com.jsnums
. It’s not the prettiest solution, but it offers a dropdown list with the descriptions. Select an account, click OK, and it will expand only the account number.
You don’t need to know how the code works to customize this Snippet. You can simply customize the account
Popup Menu by double-clicking it.
Bonus Option: Regular Text Snippets
If the menu isn’t necessary, you could simply create Snippets for each account number. So ;checking
would expand into 12345 and ;savings
would expand into 67890.
2 Likes
In the JavaScript snippet below, you need to modify the key-value pairs in the code and the Popup Menu, but the result is elegant:
In iOS, you would add this code to a JavaScript snippet:
// Define the bank accounts directly
let accountNumber = {
"Checking Account": "12345",
"Savings Account": "67890",
"Investment Account": "11223"
};
let account = "%fillpopup:name=Select the account:default=Checking Account:Savings Account:Investment Account%";
accountNumber[account];
%filltop%
Thanks Josh. This is fantastic and really appreciate the explanation. I have subscribed to the group and found the snippet in there to play with.
I knew there would be a better way. I can see me using this in a number of different snippets now.
1 Like
Very cool, I realized I could add %filltop%
to the com.jsnums
Snippet to make it look cleaner:
Lots of options in this topic! In this case, you can create a JavaScript object with a key-value pair like @HaniSarji or you can insert a native TextExpander Popup Menu.
Glad we could help!