Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
April 7, 2021 at 4:32 PM #44073
In reply to: Keep field the same value from previous
Daniel Leu
ParticipantIf you have to inventory so many things a day, it might be better to import the data using CSV files.
Or you can use a simple script that creates a new record and propagates your customer fields from the current records, or duplicate a record and delete unwanted data.
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksApril 6, 2021 at 8:50 PM #44061In reply to: Conditional Formatting – Feature Proposal
Sam Moffatt
ParticipantYou’re welcome to shoot me an email but I also don’t mind having the conversation on the forum. The advantage of the forum is that multiple folk can respond and it may also help the next person who has similar questions as well. That’s part of the reason I started on the YouTube videos to try to show off visually, as well as textually, potential solutions to problems. If you want, perhaps start a new thread in the script talk or otherwise my username is my email, pretty easy to find.
April 6, 2021 at 9:32 AM #44053In reply to: Conditional Formatting – Feature Proposal
Paul Lees
ParticipantHi Sam,
Im afraid most of what you did in the video was way way beyond me. I did set up a trial database and tried to copy exactly what you did but failed miserably, despite devoting some 2 hours to it against your 16 minute video!! (Guess that’s why I’m a hell pilot and not a programmer.) I kept getting a scrip error on line two when running the check on the field script and not knowing diddly couldn’t rectify it.
I’m not sure that I will crack this one to be honest but will try again soon.
Once again thanks for trying for me.
CheersPaul
April 5, 2021 at 7:44 PM #44047Sam Moffatt
ParticipantI don’t think there is a mutliselect prompter, the documentation in general is on the Javascript API page. The prompter stuff is relatively new in the grand scheme of things and not fully fleshed out, it’s a step towards more programmatic UI interaction.
April 4, 2021 at 11:12 AM #44040Sam Moffatt
ParticipantMissed the iOS bit, unfortunately no keyboard shortcuts there for scripts though that’d be cool addition as Apple positions the iPad more and more towards being keyboard friendly. It’s definitely a few taps to run a form script if you want to take that approach but it sounds like the checkbox approach mostly works for you. If you tap the currently selected record again it should refresh the display.
The prompter stuff for your use case isn’t too bad. You need to split it up into two pieces: getting the list of items for the pick list and handling the popup event. I gather you have a way of figuring out the set of actors and then all you need to do is feed that into the prompter.
Here is something that should do the trick, you’ll need to change the
setFieldValueline to match you field name and provide an implementation forgetActorNames:var actorName; function callbackFunction() { if (actorName) { console.log(actorName); record.setFieldValue('fld-actorname', actorName); document.saveAllChanges(); } } function getActorNames() { return ['Actor 1', 'Actor 2', 'Actor 3']; } function popup() { let prompter = Prompter.new(); prompter.addParameter('Actor: ', 'actorName', 'popup', getActorNames()) .show('Select Actor', callbackFunction); } popup();April 3, 2021 at 4:16 PM #44039johnny_law
ParticipantSam that is a great idea, but I don’t have a Mac and am using the IOS version. That is the issue, how do I get the pop-up (no keyboard shortcuts). I have also had difficulty with the prompter and async functions. But that is because I am a novice that knows enough to cause trouble.
Using a checkmark field is an option but I always have issues with the screen updating after execution.
I have been putting a date/time field in that causes a form script to run when it is undefined. After the script runs it sets the current date/time
April 3, 2021 at 3:09 PM #44038In reply to: Scripts and searching
Sam Moffatt
ParticipantReading through your process a few times, I wonder if triggering a script might solve some of what you’re trying to do though I might be missing something. If you have data inside the records that can be actioned, you could use a script to parse that and handle it. There is a progress bar interaction and the run button turns into a spinner while a script is running (not sure if you can detect either of that with your automation but it might work).
I’m also wondering if your pain point is linking if using a JOIN Link to Form type to do that might help with that to automatically link records together. To use the JOIN would require a shared key between the two records which if you have that along the way somewhere might make things a little easier.
April 3, 2021 at 2:35 PM #44034In reply to: Scripts and searching
Victor Warner
ParticipantBrendan,
Thank you for the reply. Yes, it is part of a larger automation.
Here is the long explanation:
A bit of background, until 2 years ago I use Filemaker to maintain my records concerning my work as a Notary Public in England. FileMaker provided many tools / features not present in Tap Forms, but also is far more complex than my needs – and also when I set it up I did not deal with some of the links between (in Tap Form terminology) Forms in quite the right way, creating two Forms than I really needed.
When I set up (or rather re-created) the database Tap Forms I also corrected what was not working – but I have been able to go much further in automating what I need to produce for client with Tap Forms – which has made it much much much easier than with Filemaker (even though I have had to struggle with Javascript).
I am now exporting, record by record each of the Filemaker for records prior to 2018 – typically up to 7 forms for each client (client contact details, passport details, other id, notarial act, notarised documents, time spent, disbursements) – all which were linked (for example, the client contact form is linked to the passport form and the other ID form, and each of which might contain several records).
I have keyboard maestro macros to format the exported CSV files from FileMaker (add field names needed for the import (as the field names are different between FileMaker and Tap Forms), add a For Duplication field and a X for that field), import all the Forms into Tap Forms at one go rather than one at a time. I added an extra field (For Duplication) which just contains a X, and the saved search to find the records who with X for each Form, to easily pick out the those records and then recreate the links between the forms.
Again with Keyboard Maestro for each Form I can automatically add the links but to create the links for all the Forms at one go I need to be able to reliably access for each Form the saved searched For duplication.
If I was able to do so – than I can speed up the import.
As mentioned in my previous post for some parts of the Tap Forms it is just not possible to access them with a shortcut, menu or by tabbing. But it possible to do so with UI Browser finding the GUI code to do so. An example is attached. But the AppleScript GUI code it generates does not work for the saved searches in the Forms list.
So it is more than just saving a click. If you have any suggestions I would be very grateful to hear about them.
Attachments:
You must be logged in to view attached files.April 3, 2021 at 1:56 PM #44031In reply to: Scripts and searching
Brendan
KeymasterHi Victor,
So what you’re looking for then is user interface automation? That is a form script that clicks on the “For duplication” saved search for you?
If so, then a script won’t do that. Right now the only user interface automation a script allows you to do is to select a specific record.
I’m just curious what the purpose of that would be though? To save a click? Or is there a larger form of automation you’re looking to integrate this into?
Thanks,
Brendan
April 3, 2021 at 11:46 AM #44026In reply to: Scripts and searching
Victor Warner
ParticipantSam,
Thank you for the detailed reply.
I can see that script duplicates the fields which have an X in the For duplication field.
I am sorry to be difficult, but this is not what I would like to achieve.
When I click on the ‘For duplication’ saved search under the relevant Form in the Forms list what happens is, in effect, Tap Forms shows (filters) only and displays the records for which in the For duplication there is a X.
That is all I am trying to achieve with a script (if possible). Tap Forms has no way of ‘reaching’ a saved search via the menu, a shortcut or pressing the tab key successively that I am aware of. There are other parts of Tap Forms which are also not reachable, but I have been able to get to them through the use of UI Browser, but even this is having difficulty with saved searches.
If of assistance, the example database I am using is attached.
Attachments:
You must be logged in to view attached files.April 3, 2021 at 10:55 AM #44025In reply to: Scripts and searching
Sam Moffatt
ParticipantSomething like this should do the trick as a form script:
var dupes_search = form.getSearchNamed('For duplication'); for(var baseRecord of dupes_search.getRecords()) { baseRecord.setFieldValue('fld-dupeflag', false); var dupeRecord = baseRecord.duplicate(); } document.saveAllChanges();First line gets the named search, the next line loops over all of the records in the search, the
setFieldValueunsets your dupe flag field. Thevar dupeRecordline duplicates thebaseRecordand hands you a copy of the record with the ever presentdocument.saveAllChanges()to flag you want to save things.You might want to swap the
baseRecord.setFieldValueline to be after theduplicate()call and apply it to only the duplicated record (e.g.dupeRecord.setFieldValue('fld-dupeflag', false)) however I’m not entirely sure.Haven’t tested this but I think this should do roughly what you need. It’ll take anything that matches the saved search ‘For duplication’, duplicate them for you and clear the dupe flag (useful if you don’t want to dupe them again).
April 3, 2021 at 8:49 AM #44022In reply to: Scripts and searching
Victor Warner
ParticipantDaniel,
Thank you for the reply.
What I would like to do is simply create the equivalent of selecting by clicking on the saved search “For duplication” under the relevant Form in the Forms list, so that the only the records for the field called For duplication that contain a X appear.
Unless there is an option I have not discovered, saved searches are not selectable via a menu (or a shortcut key). A form script can have a shortcut assigned to it.
Is what I wish to do achievable with a form script?
To be clear what I am trying to create the equivalent of, attached is a video.
Attachments:
You must be logged in to view attached files.April 3, 2021 at 8:24 AM #44019In reply to: Scripts and searching
Daniel Leu
ParticipantWith these two lines you get an array of records for your named search stored in a variable. Then you have to do something with them. What do you want the script to do?
A form script is used to perform an action such as to modify a record. A field script returns a value that is stored in the script field. So they serve a different purpose.
Brendan, good catch! Thanks!
Cheers, Daniel
---
See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricksApril 3, 2021 at 7:56 AM #44018T.L. Ford
ParticipantThe object model can be used to walk all over the database from anywhere to everywhere using the IDs and a good understanding of the model.
http://www.cattail.nu/tap_forms/tap_forms_scripting_102/index_object_model.htmlApril 3, 2021 at 7:54 AM #44016T.L. Ford
ParticipantLink to Form fields do not show up in the interface’s available fields for Linked forms, but you can still use them.
Example:
i.e.
Projects (project name) -> Project_Employees (allocated manhours) <- Employees (employee name)Show:
Project, Employee Name, Allocated HoursIn a Projects form script, you can easily get the list of allocated manhours from the linked field. However, you need to also get the linked field for Employees from the Project_Employees table for the Employee name.
Even though it doesn’t show up in the interface’s picklist, you can still use them. You just have to go get the IDs from the Linked form.
See the attached database, which shows this in action as well as how to build a Summary report from partial reports.
Attachments:
You must be logged in to view attached files. -
AuthorSearch Results