Search Results for 'script'
Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch › Forums › Search › Search Results for 'script'
-
AuthorSearch Results
-
April 3, 2021 at 3:09 PM #44038
In 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.April 3, 2021 at 2:42 AM #44012In reply to: Scripts and searching
Victor Warner
ParticipantDaniel, Brendan,
Thank you for the replies. I must be missing something very fundamental as I do not seem to be able to be apply your replies.
For Brendan’s post:
var dupes_search = form.getSearchNamed('For duplication'); var records = dupes_search.getRecords();Do I put this is in a form script? Is any other code needed so that what is returned are just the records which match the ‘For duplication’ saved search?
Having entered those two lines into a Form Script, nothing is returned.
April 3, 2021 at 1:05 AM #44011Sam Moffatt
ParticipantOne way I do something like this is to use a Link to Field JOIN field with a common key between the grandparent record and the child record. You might be able to use a calculation field to project down a key value though for my use case I already had one that I was replicating via scripting.
If all you want is all of the grand children listed in the grandparents record (which is very useful at times) then the JOIN field might be the answer to do it somewhat automatically.
If that isn’t what you had in mind then you’re going to be doing some scripting however you can use the calc field if the JOIN field idea works.
April 2, 2021 at 10:57 PM #44006johnny_law
ParticipantThanks Brendan,
This helps me understand the picklist programming. I’ll play around with it.
Unfortunately it needs a document close/open. I really need an ability to have a dynamic picklist on a record by record basis.
BTW I have really enjoyed the increase in power with scripting in Tap Forms. My favorite app.
April 2, 2021 at 5:19 AM #44005Gerhard Hoffmann
ParticipantHi Brendan,
yes, that is what I need.
Do you have an idea, how that script looks like?April 2, 2021 at 4:32 AM #44004Topic: Scripts and searching
in forum Using Tap Forms 5Victor Warner
ParticipantI am trying to understand how to use the scripting commands to automate some searches, but not able to understand from the available documentation how to use them.
Example:
1. I have a form called Time spent, one of the fields is called ‘For duplication’. For some records the only entry is a “X”
2. I have created a saved search called “For duplication” which only function is search records in the ‘For duplication’ field which contains an “X”Queries
1. Is it possible to create a form script which uses the saved search called “For duplication”
2. Also how would I create a search with a script to search a field for a value (such as search the “For duplication” field for a “X”.Any help gratefully received.
April 1, 2021 at 11:23 PM #43999Brendan
KeymasterHi Gerhard,
Do you mean you have a 3 level hierarchy and you want to show data from the lowest level to the top level?
Like
Parent -> Child -> Grand Childand you want to show data fromGrand Childon theParentform?You can do that with a script, but the way the data would be displayed would be just in a text format, not in something like a table like regular Link to Forms are displayed.
-
AuthorSearch Results