Tap Forms Form Hooks

Viewing 6 reply threads
  • Author
    Posts
  • May 26, 2022 at 6:34 PM #47391

    Bernie McGuire
    Participant

    Are there any available hooks in a Form such as ‘ON Open” o ‘On Close’ etc. Where one could have a script execute based on this event?
    Thanks

    May 26, 2022 at 11:18 PM #47400

    Brendan
    Keymaster

    Hi Bernie,

    No there aren’t. I have not implemented any triggers like that.

    What’s your use case for this?

    Thanks,

    Brendan

    May 27, 2022 at 10:16 AM #47401

    Bernie McGuire
    Participant

    Brendan Hi thanks for the opportunity to explain. I will try to be brief but somewhat detailed.
    I have 3 linked forms
    1. Drill Description
    2. Drill Results (One record for each time a drill is executed)
    3. Drill Total Results (One Record for each Drill with accumilated totals of rows in number 2 above. Totals are calculated using Calculation of linked fields

    One time process : Load a description for all possible drills in Form 1 assign a ‘DrillID”

    Eacb time a drill is executed :
    1. Open form 1, drill description
    2. Pick a drill and click on the + next to linked Form Drill Results (2)
    3. Enter Results and either pick a new Drill Description or exit

    The Problem as I see it. The records in table 3 (Drill Total Results) need to be manually added the first time a drill has results which for me, is extra work on the user part I like to avoid. As if the user forgets to pen the Form and add a row, no totals will ever be displayed.

    What I have done is write a script that will look at all the records in table 2 (Results) and check if a Record exists (by Drill ID) in Table 3 (Totals), if exists, do nothing, if not exists add new row. Now when a Drill Description is open the linked forms for both Results and Totals will be present and viewable.
    This script has to be executed manually using the Form Run Script command. It would be nice if it could be executed ‘ON Open’ automatically.
    Or is there another way to accomplish script execution without user intervention?

    Hope this is clear.
    Thanks for the help
    Bernie

    May 27, 2022 at 10:18 AM #47402

    Bernie McGuire
    Participant

    Bye the way, I am linking the forms via JOIN
    Bernie

    May 27, 2022 at 12:22 PM #47403

    Brendan
    Keymaster

    Field scripts execute whenever a value they’re monitoring changes. So if you’re entering data anyway, you could monitor for that change and insert the records you want at that point. You don’t even have to be doing anything with the field you’re monitoring. Just to know that it has changed and the script will be triggered. But no script will get triggered just by viewing a record.

    May 27, 2022 at 6:18 PM #47404

    Bernie McGuire
    Participant

    Brendan Hi Ok Ill think about this. I guess there is no problem to insert a Record in a different form than the form with the field script, correct ? Ill give it a try and post here the results.
    Bernie

    May 27, 2022 at 7:15 PM #47405

    Brendan
    Keymaster

    That’s right. You just need to get a reference to the other form like this:

    var other_form = document.getFormNamed("Some Other Form");

    Now you can ask it for its records, create records, etc.

Viewing 6 reply threads

You must be logged in to reply to this topic.