Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 1 through 15 (of 3,099 total)
  • Author
    Search Results
  • Brendan
    Keymaster

    A Join relationship is the same as a Many to Many except it is managed by a common field in the parent and child forms. Perhaps your script could just populate the common field? Then Tap Forms establishes the relationship for you based on matching values in the matched fields in both forms.

    #54257
    Brendan
    Keymaster

    Hi Eric,

    It takes a lot of time to keep Tap Forms up-to-date with all the changes that Apple makes to the operating systems year after year. Plus to fix bugs, add new features, and so on. To expect a one-time payment to get the benefits of all of that forever is no longer financially viable for me. Yes, there’s the upgrade model, but as you know, Apple doesn’t support that model in the App Store. I did that once before with Tap Forms 5 by releasing it as a new application with a migration function. Tap Forms Pro is the last time that I have to do that as now I’ll be able to release fixes, new features, and updates to account for OS changes as I go. I won’t have to hold back updates or new features for some big feature upgrade once a year or two. Everyone will now get them as I finish them. Plus I’ve been providing support to all my customers, no matter which version they bought for 18 years now. That also takes time away from development. I love providing help to all my customers. Everyone has always been super nice and I’ve been very grateful for that.

    The Rosetta issue is unfortunate. I had fully expected Apple to just keep it there forever. I put a note in the App Store for Tap Forms 5 that it does require Rosetta. It will continue to function forever on Intel Macs of course and anyone who stays at macOS 27 on Apple Silicon Macs. I know that’s not feasible for everyone though. But it is what it is and the decision to remove Rosetta was out of my hands. Tap Forms 5 relies on a database engine that is no longer supported and was compiled for Intel on Mac. In Tap Forms Pro I yanked that out and replaced it with Apple’s CoreData engine and raw SQLite. So that will never be an issue again. Just doing that took me about a year of development.

    So I’m very sorry that you’re disappointed in my decision to move to a subscription model, but without having done that, I saw the end of the road for Tap Forms. Revenues were declining year after year and now I’ve finally managed to turn that around. Now Tap Forms Pro has a very bright future ahead of it.

    Tap Forms Pro has been out for just over a year now and I’m now starting to see a rise in my income from last year rather than just barely scraping by with a declining income year after year.

    I hope you better understand my decision now.

    Brendan

    Steve-Kai Vyska
    Participant

    Hello everyone,

    I have a form called **Rental Claims** which contains a subform called **Bookings**. The Bookings subform is populated by a script that imports transactions from a bank statement file. This part is working well.

    When I work manually, I can use the selection dialog in the Bookings subform to view existing booking records and assign them accordingly.

    My question is: **How can I perform this assignment via script?**

    I cannot simply create the bookings directly in the script because I may need to assign multiple bookings to a single rental claim, or split a single booking across multiple rental claims. Therefore, a **many-to-many relationship** would be ideal, but I have not been able to create these assignments through scripting.

    Has anyone done something similar or can point me in the right direction?

    Thanks in advance for any information or suggestions.

    Steve

    #54252
    eric
    Participant

    Good morning, Brendan.

    One of the reasons I chose to use your application—and support a small independent developer rather than a large tech company—was that, years ago, you mentioned that you were not a fan of subscription-based software. I appreciated that philosophy and it was one of the factors that led me to purchase Tap Forms.
    So, to my disappointment, I now see that Tap Forms 5 appears to be reaching end-of-life and that the future direction is moving toward a subscription model. Needless to say, I am not particularly happy about this change.

    What concerns me even more is that Tap Forms 5 currently relies on Rosetta. As Apple continues to phase out support for Rosetta, there will likely come a point where Tap Forms 5 will no longer run on future versions of macOS. This effectively leaves existing customers with little choice but to move to the new subscription-based version if they want to continue using the software.

    Could you clarify the situation? Will Tap Forms 5 continue to be available and supported as a one-time purchase application, while the new version is offered separately as a subscription? Or is the subscription model intended to completely replace Tap Forms 5 once Rosetta is no longer available?

    If the latter is the plan, then I will unfortunately need to start looking for alternative software. I understand that subscriptions provide ongoing revenue for development, but personally I am not willing to pay an annual subscription for a personal database application. At roughly $45–50 USD per year, the cost is difficult for me to justify, especially when I originally purchased the software with the expectation of a traditional one-time purchase model.

    Thank you for any clarification you can provide.

    Kevin Winspear
    Participant

    I’ve been experimenting with Tap Forms Pro’s scripting capabilities and wanted to share a workflow I’ve been using successfully.

    One of my goals was to avoid having my data locked into any single application. I use Tap Forms as my structured database, but I also use Obsidian for note-taking and knowledge management.

    Using a Tap Forms script, I’ve set things up so that whenever I add or update a record, a Markdown (.md) file is automatically generated and written directly into my Obsidian vault.

    For example, in my Movies database, the script creates a note containing:

    * YAML frontmatter
    * Movie metadata (title, year, rating, tags, etc.)
    * Cover image references
    * IMDb links
    * Description and cast information

    The generated note is immediately available in Obsidian without any manual export step.

    A simplified workflow looks like this:

    Tap Forms Record
    → Metadata Updated
    → Script Runs
    → Markdown File Generated
    → Obsidian Vault Updated

    One advantage is that my information remains portable. The data exists in Tap Forms, but I also have a complete set of Markdown files that can be used in Obsidian or any other Markdown-based application.

    I’ve now started using the same approach with several of my Tap Forms databases, not just movies.

    I’m posting this partly because I think Tap Forms’ scripting features are incredibly powerful, and partly because there may be other users interested in integrating Tap Forms with Obsidian or other Markdown-based workflows.

    If there’s interest, I’d be happy to share more details about the script and how I set everything up.

    #54241
    Daniel Leu
    Participant

    This shouldn’t be difficult to do with a script. Would you be willing to share your Tap Forms template with me? (You can find it under File > Export > Form Template (TFF). If you’d rather, feel free to email it to me. Once I have the template, I’ll give it a shot.)

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #54238

    In reply to: Using tablefields

    Steve-Kai Vyska
    Participant

    Sorry for the late Answer was messing around with the scripts. Yes it is working 👍

    #54237
    Brendan
    Keymaster

    Your best bet for now would be to export your records to an Excel spreadsheet and then import it into Excel (or Numbers) and do some summarization there. At the moment I don’t have a function that would do that. Tap Forms will compute totals for each category, but it will also display the details.

    But of course you could write a script for it to just dump out the summary data in the console. But it would be easier for you to use Excel. Especially if you’re not familiar with scripting.

    Thanks,

    Brendan

    pierrot_rennes
    Participant

    Hello,

    I have a database with 5185 records in 58 categories.
    It’s a collection of comic book puzzles, and the different categories correspond to the comic book titles, as shown in the screenshot.
    In the database, there are two scripts that highlight puzzles in the collection and those that are incomplete (scripts created by a form user at least 6 years ago).
    I would like to automatically retrieve the number of puzzles in the collection and the number of missing puzzles for each category into a table.
    I don’t know if this is possible with a script, and I don’t know how to do it either, as I’m not familiar with scripting.
    Thank you for your information, and perhaps it’s not feasible. The screenshots show my database, the relevant fields, and a table as it could be created.

    Attachments:
    You must be logged in to view attached files.
    #54219

    In reply to: ordinal day?

    Glen Forister
    Participant

    I got the script to work, thanks. BUT, not all dayofyear values are the same for multiple records of the same day. What does that, to be off a day?
    Thanks for sticking with me on this.

    Attachments:
    You must be logged in to view attached files.
    #54214

    In reply to: ordinal day?

    Glen Forister
    Participant

    OMG, how did I miss using the script window instead of the calc. I’m sorry. Just haven’t had to edit a script in a while I guess.

    I changed the field type to SCRIPT.
    I bring up the SCRIPT window and it has an example starting script. I can delete it, but I can’t past into the winddow the script you supplied.
    If I try to type it, I’ll have many mistakes to weed out and that will be a big waste of both of our time.
    How can I paste something into that SCRIPT window. I remember not being able to add the fld- number by copy and paste, but I never complained about that until now.

    #54210

    In reply to: Using tablefields

    Daniel Leu
    Participant

    You can use field.sortedTableFields to get field details of a table.

    Following function copies the values from the source record to a new row in the table of the current record. I’ve verified for text and number fields.

    /**
     * copyRecordToTable(srcRecord, tableId)
     *
     * Copies values from srcRecord into a new row appended to the table field
     * identified by tableId, for all fields whose names match between the
     * source record's form and the table.
     *
     * @param {TFRecord} srcRecord  - The source record to copy values from.
     * @param {string}   tableId    - The field ID of a Table-type field on the record.
     * @returns {TFRecord}          - The newly created table row record.
     */
    function copyRecordToTable(srcRecord, tableId) {
        // Resolve the table field from the record's own form using the field ID.
        const table = form.getFieldWithId(tableId);
    
        // Get the fields defined on the table, keyed by name for fast lookup.
        const tableFields = table.sortedTableFields;
        const tableFieldsByName = {};
        for (var i = 0; i < tableFields.length; i++) {
            var tf = tableFields;
            tableFieldsByName[tf.name] = tf;
        }
    
        // Add a new row to the table.
        const newRow = record.addNewRecordToField(tableId);
    
        // Walk every field on the source record's form and copy matching values.
        const sourceFields = srcRecord.form.fetchFields();
        for (var j = 0; j < sourceFields.length; j++) {
            var sf = sourceFields[j];
            var match = tableFieldsByName[sf.name];
            if (match) {
                var value = srcRecord.getFieldValue(sf.getId());
                newRow.setFieldValue(match.getId(), value);
            }
        }
    
        return newRow;
    }
    

    To verfiy, I use this sample script which just adds a random record to the table.

    function selectSourceRecord(formName) {
    	// return a random record from the form formName
    
    	const records = document.getFormNamed(formName).fetchRecords();
    	const index = Math.floor(Math.random() * records.length);
    	return records[index];
    }
    
    function Copy_Record_To_Product_Table() {
    
    	// source form name	
    	const sourceFormName = "Products";
    
    	// select a random record from the source form
    	const sourceRecord = selectSourceRecord(sourceFormName);
    
    	// table field name
    	const tableFieldName = "Products";
    
    	// get the table field
        const tableId = form.getFieldNamed(tableFieldName).getId();
    
    	// copy the record to the table
    	copyRecordToTable(sourceRecord, tableId);
    
        document.saveAllChangesAndRefresh();
    }
    
    Copy_Record_To_Product_Table();
    

    Let me know if this works for you!

    • This reply was modified 1 week, 2 days ago by Daniel Leu.
    • This reply was modified 1 week, 2 days ago by Daniel Leu.
    • This reply was modified 1 week, 2 days ago by Daniel Leu.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #54209

    Topic: Using tablefields

    in forum Script Talk
    Steve-Kai Vyska
    Participant

    Hello everyone,

    I’m currently experimenting with the “Table Fields”.

    When creating one, there is an option to select a form. If I choose an existing form, I can use the button **”Copy fields into table…”** to insert the fields title from the previously selected form into the table. This works perfectly. However, I’m a bit curious about the description text displayed there:

    > “Tap Forms will copy values from the selected records based on matching field titles.”

    Is this functionality only available through the form selection field, or is there a way to achieve the same thing via scripting?

    When I tried to do this with a script, I could only get it working by hard-coding the fieldsIDs beforehand. In other words, if I add a new field to the table, I have to manually add the corresponding field ID to the script.

    Is there any way to read the table column headers via javascript, so that the script could iterate through them and (since the names are identical) retrieve the corresponding values from the original form automatically by getFieldNamed(‘Name’)?

    Thanks for any ideas, and have a great weekend!

    Steve

    #54208

    In reply to: ordinal day?

    Brendan
    Keymaster

    That’s a script for a Script Field. It’s not a formula for the Calculation Field.

    You need to also call return result; at the end of the script.

    But you also need to pass in your field’s date.

    Here’s a more full example:

    function Day_Number() {
    
        const dayOfYear = myDate => {
            const year = myDate.getFullYear();
            const firstJan = new Date(year, 0, 1);
            const differenceInMillieSeconds = myDate - firstJan;
            return (differenceInMillieSeconds / (1000 * 60 * 60 * 24));
        };
        var date_id = 'fld-22b8461cd7e14fbc988ecd1b7b22a013';
        let my_field_date = record.getFieldValue(date_id);
    
        const result = dayOfYear(my_field_date);
        return result.toFixed(0);
    
    }
    
    Day_Number();

    You’ll need to replace the date_id (‘fld-22b8461cd7e14fbc988ecd1b7b22a013’) with your Date field’s Field ID.

    #54205
    Paul Cotton
    Participant

    Re 10 – scripts triggering on field change: this was user error and Brendan provided the solution via email.

    I was using getId rather then explicitly identifying the field in the script itself:

    mine that didn’t work correctly:

    var currval=record.getFieldValue(form.getFieldNamed(“Currency”).getId());

    Brendan’s solution that works great:

    var currval=record.getFieldValue(‘fld-6cc122549b004a09b0e21e8b4f76b313’);

Viewing 15 results - 1 through 15 (of 3,099 total)