Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Using Tap Forms › Can't script a record update on iPad
October 7, 2018 at 6:24 AM #30938
I have a test script that updates a record on MacOS Tap Forms, but it doesn’t update the record on my iPad.
Here is an example:
var field_id = ‘fld-43e292a99a1646f1b5574954169ab319’;
Could you please point me in the right direction to get this working on my iPad (works great on MacOS).
The database was created on the Mac and shared to the iPad, then synchronised with Nearby Sync.
Also, does the concept of current record exist in iPhone scripts?October 7, 2018 at 6:32 AM #30939
I’ve just worked out what the issue is.
On the iPad the record that I’m updating is the first on the list, not the currently selected one.
How do I get the current record, not the first one?
ThanksOctober 7, 2018 at 5:27 PM #30942
Is this a form script or a Script field?
If it’s a Script field, then
recordshould refer to the current record.
If it’s a form script, then you’ll need to find the record you want to update within the script by searching for the right record by looping through them.October 7, 2018 at 11:23 PM #30947
Good question about whether it is a form script or field script. It’s a form script (would updating a record in a field script make sense?)
I don’t want to loop through and find the record as I am scraping a website (for missing image data) and don’t want to run though all 1000 records and hit the website. On the Mac I was relying on the current record, I guess I can’t do that on iOS.
I will add an extra check box that I will set manually before running the script and then the script can search on that.October 7, 2018 at 11:32 PM #30952
Sure, you could update a record in a Field Script. An example of that might be selecting something from a Pick List that triggers a script to run and it updates a different field in that same record.
You could also have a Saved Search that fetches the records you want to update and run the script just on those records. You would use
form.getRecords(). Or you can ask the form for a specific with a provided name. E.g.
var search = form.getSearchNamed('Action & Adventure');Then do
search.getRecords();.October 8, 2018 at 2:51 AM #30955
Thank you for all your help.
The solution I have gone with is to have a field script that updates the record (from the webscrape). I have also added a check mark to say when I want it to run.
The field script checks the value of the check mark and if set, it runs the web scrape, updates the fields and then unchecked the checkmark.
You must be logged in to reply to this topic.