Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Tap Forms Template Exchange › Shopping List
- This topic has 19 replies, 4 voices, and was last updated 1 year, 6 months ago by robinsiebler.
-
AuthorPosts
-
June 7, 2021 at 12:15 PM #44557
robinsieblerParticipantSomeone expressed and interest in this, so I am uploading it. Thanks to Sam for all his help!
This is a simple Shopping List. There are 3 forms. The actual shopping list form, a category form and a products form (which contains the items to populate the shopping list with).
Adding an item to the shopping list is done via a Siri Shortcut (see attached screenshot).
The expected input to the shortcut is <number> item. If a number is not provided, 1 is assumed. For example, you could say ‘3 Peaches’ or ‘Heavy Cream’.
When an item is added to the shopping list, it will see if it exists in the product form. If it does, the item will be also given a category (if it exists). If the item does not exist, it will be added to products, but it will not have a category (this will have to be added manually).
Items are sorted in the Shopping List alphabetically, by category.
There is only 1 script ‘Get Item From Clipboard’ and it does all the work.
Enjoy!
Attachments:
You must be logged in to view attached files.June 7, 2021 at 4:24 PM #44564
robinsieblerParticipantI added a script (Combine Items) to combine duplicate items into one.
function combineItems() { // Combine duplicate items into one item var dict = {}; var records = form.getRecords(); var item_id = 'fld-097c3d751c854b1fb4b528238d48b2c4'; var quantity_id = 'fld-285e2c9de4924b7fbba2fd8311ceb625'; for (var i = 0, count = records.length; i < count; i++){ item = records.getFieldValue(item_id); quantity = records.getFieldValue(quantity_id); record_id = records.getId(); if (dict[item] === undefined) { dict[item] = [quantity, record_id]; } else { dict[item][0] = dict[item][0] + quantity; form.deleteRecord(records); rec = form.getRecordWithId(dict[item][1]); rec.setFieldValue(quantity_id, dict[item][0]); form.saveAllChanges(); } } } combineItems();
June 7, 2021 at 6:05 PM #44565
robinsieblerParticipantI added over 200 products to the products database and also added the ‘Combine Items’ script
Attachments:
You must be logged in to view attached files.June 9, 2021 at 1:54 AM #44571
Roger CuthbertParticipantJust what I have been looking for. It’s good to see people still using TapForms. Thanks.
June 9, 2021 at 2:33 AM #44572
robinsieblerParticipantI fixed some bugs and added a notes field. I also added another 100 products to the products form. In addition, I updated the Shortcut to prompt for a note (see screen shot). However, Siri is stupid! If you say ‘No’ when you are prompted for a note, Siri bails on the entire script! So, instead of saying ‘No’, say ‘Later’ and you will not be prompted for the note.
I should mention that you have to manually create the Shortcut using the attached screenshot as a guide. I have no clue how to share a shortcut outside of the Apple ecosystem.
Attachments:
You must be logged in to view attached files.June 9, 2021 at 10:41 AM #44580
Roger CuthbertParticipantWhen I add items to the shopping List form by selecting them manually from the dropdown that picks from the Product Form it doesnt bring over the category into the shopping list form.
Not sure if it does when using Siri though.
Any thoughts on how to fix that?
June 9, 2021 at 11:06 AM #44581
robinsieblerParticipantI never intended it to be done manually (since I originally wrote this for my wife, who would do it via dictation). Let me look into it!
FWIW, it works just fine via the shortcut.
June 9, 2021 at 12:18 PM #44582
Roger CuthbertParticipantI’ve tried with Siri and it still creates just the item without a Category at my end ?
June 9, 2021 at 12:51 PM #44583
robinsieblerParticipantAnd the item you are adding is in the Product form and has a category? If so, could you try this? Add the item in question to the clipboard and just run the script ‘Get Item from Clipboard’. Let me know what happens.
June 9, 2021 at 3:06 PM #44584
Roger CuthbertParticipantI added Naan manually and the shopping list record did not add the category.
I created a shortcut as you suggested. Added Naan to the clipboard and ran your script and the category is added correctly.
June 9, 2021 at 3:13 PM #44585
robinsieblerParticipantSO just to verify:
1. If you manually add an item to the Shopping List, the categopy is not added.
2. If you manually run the script, the category is added.
3. If you run the Shortcut the category is added.If all of that is true, I think all that I have to do is a add a field script to the Shopping List form that will update the category.
I will try that and get back to you.
June 9, 2021 at 3:36 PM #44586
Roger CuthbertParticipantI’m in the uk. I will check in the morning. Thanks so much for helping.
June 9, 2021 at 8:07 PM #44587
robinsieblerParticipantFixed!
Attachments:
You must be logged in to view attached files.June 9, 2021 at 11:26 PM #44589
Roger CuthbertParticipantExcellent. Thanks. Tested and working.
I would add just one more thing, a checkbox field (in my trolley) to the shopping list form to tick when you have the item. And if the filter is showing unticked items the user will only see items still left to buy.
Great set of forms thanks so much.
June 10, 2021 at 1:14 AM #44591
robinsieblerParticipantOk, I added the checkmark field. In addition, I added a Search Filter for unchecked items and a script you can use to remove checked items.
Attachments:
You must be logged in to view attached files.June 10, 2021 at 5:39 AM #44593
robinsieblerParticipantMinor code cleanup and fix for Siri stupidity
Attachments:
You must be logged in to view attached files.January 26, 2022 at 1:51 AM #46448
Yvette MParticipantHow come I can’t import this into Tap Forms? I’m on an iPhone with updated Tap Forms. Thanks
January 26, 2022 at 11:40 AM #46454
BrendanKeymasterHi Yvette,
The Shopping List is a full database document. So you will need to probably download it to your Mac, unzip it, then AirDrop it to your iPhone. Or if you download it to iCloud Drive you can then launch Tap Forms and open any document, then go to Tools > Backup & Restore, then tap on the Download button. Find the file in iCloud Drive (or wherever you stored it), then select it to download it to Tap Forms. It’ll appear as a backup. You can then tap on it and then tap on the Restore Backup button.
It will appear as a separate document in your main Documents area. So you’ll need to close the currently opened document to see it.
Thanks,
Brendan
January 26, 2022 at 4:28 PM #46457
Yvette MParticipantI didn’t know to press the restore button. Got it now. Thanks!
April 20, 2023 at 11:20 AM #49359
robinsieblerParticipantI fixed the annoying bug (blank entries in the Product form). The Products form now has 460+ items!
Attachments:
You must be logged in to view attached files. -
AuthorPosts
You must be logged in to reply to this topic.