Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › create “form_record_id” without export
- This topic has 6 replies, 3 voices, and was last updated 4 years, 1 month ago by Sam Moffatt.
-
AuthorPosts
-
September 28, 2020 at 2:24 AM #42054
matt coxonParticipantHi is there a way to generate the field “form_record_id” without actually having to run an export to produce it.
Use case is . I have a number requests that I import progress on each day (100 or so) , updates either come directly from me to the Tapforms or from the daily import. I have the updating working fine using the export method to obtain the form_record_id and then an excel vlookup ensure current records are matched. For new records I’d like not to export from tapforms to obtain the form_record_id as they are only 1 or 2 extra records per day. I’d like to manually update my excel vlookup table with the form_record_id once the new records are in tapforms.
Is this possible ?
Thanks
MattSeptember 28, 2020 at 9:27 AM #42056
Daniel LeuParticipantAssign following single line to a script field:
record.getId();
You might need to click on the recalculate formulas icon to get the field updated. To avoid this, you can add a dummy getFieldValue at the beginning of the script:
var name = record.getFieldValue('fld-xxxx'); record.getId();
The name variable is not used, but this way, the script is triggered when something changes with the
name
field. Obviously, use a field that exists in your form.September 28, 2020 at 11:47 AM #42057
matt coxonParticipantHi Daniel,
Thanks it works perfectly on the Mac, but on the iPhone and iPad it does not. In the error as per the picture, would you know if that is an expected result or perhaps a bug
Thanks
MattSeptember 28, 2020 at 1:12 PM #42058
Daniel LeuParticipantSorry, I don’t see a picture :(
Do you have a single record selected?
September 28, 2020 at 1:55 PM #42059
matt coxonParticipantHi Daniel Doh no picture !, I’ve re-attached but if it doesn’t attach the error is “ ReferenceError: Can’t find variable: record, line:(null)”
But actually when I select the record and then test the script (prompted by your reply) it does seem to work , so maybe a non issue (user error)Thanks
MattSeptember 28, 2020 at 2:27 PM #42060
Daniel LeuParticipantIt might not be a user error, it might just work only under certain circumstances. One is that
record
is only valid when a record is selected.I’m certain that Brendan or Sam will chip in with a better explanation since I don’t spend much time using TF on mobile.
September 29, 2020 at 8:17 AM #42062
Sam MoffattParticipantYeah, the list view doesn’t populate the
record
variable because nothing is selected but as soon as you tap into a record on mobile therecord
becomes available. This is a little different to the Mac where it is very hard to get to a state where a record isn’t selected. -
AuthorPosts
You must be logged in to reply to this topic.