Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Using Tap Forms 5 › Adding records via Apple Watch?
- This topic has 6 replies, 4 voices, and was last updated 3 years, 5 months ago by
Daniel Leu.
-
AuthorPosts
-
December 22, 2021 at 3:11 PM #46153
Karan ShahParticipantHi,
I am looking to do something simple to start off with on Tap Forms.
I want to create a simple table where I log when I feel hungry.
I have created a form on my phone where the only field is the current date and time, and I simply need to hit the “+” to add a new record.
I am going to use this for analysis separately, in excel, looking at the frequency of occurrences.
How can I add records to this table via my watch? I have shared the document and form to my watch and can see the records on my watch, but I am not seeing how to add a record to the form.
December 22, 2021 at 5:21 PM #46154
Sam MoffattParticipantI think what might work for this is to enable Siri for your document and then create a script that creates a new record. Then you can use either a Shortcut or Siri directly to create a new record with the current date and time.
December 22, 2021 at 6:19 PM #46155
Karan ShahParticipantThank you. Any guide to scripting? I’m not a coder, but if it’s simple I’m happy to look at setting up a script for this.
December 22, 2021 at 10:50 PM #46156
Sam MoffattParticipantI think for this one, if the defaults make sense the form script can be as simple as “form.addNewRecord();” and then you need to enable your script for Siri (there should be a button in the editor on your phone). I think you might also need to enable the document for Siri (it’s been a while) and then you should be able to use Siri to create a new record automatically.
December 23, 2021 at 12:19 AM #46159
BrendanKeymasterThe Apple Watch version of Tap Forms is read-only. So that’s why you can’t add a record from the watch. The scripting idea is good. Something like this:
function addNewRecord() { var new_record = form.addNewRecord(); // do something to the new record if you want, such as calling new_record.setFieldValue(field_id, "some value"); form.saveAllChanges(); } addNewRecord();
December 23, 2021 at 8:35 AM #46160
Karan ShahParticipantThanks guys – I assume for this I just swap “form” with the actual form name?
December 23, 2021 at 9:12 AM #46162
Daniel LeuParticipantNo, the variable
form
revers to the current form where you call the script from. If you want to add a record to a different form, then you first have to do avar myForm = document.getFormNamed("My Form Name");
And then you would use
myForm
instead ofform
.Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks -
AuthorPosts
You must be logged in to reply to this topic.