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,008 total)
  • Author
    Search Results
  • #53568
    Steve-Kai Vyska
    Participant

    Grüezi,

    Thanks for the code snippet, I’ll try it out later, including your ScriptHandler. By the way, while we’re on the topic of scripts, there might be a translation error in the German version. In the script overview, there’s a section with the little gear icon… it says “move to document,” but there is no “document” in the German overview. I think it should say “favorites,” and under “favorites” it should then say “switch to Formular.” I think the translation isn’t quite correct here.

    Nice Week

    Steve

    #53559
    Daniel Leu
    Participant

    You could try with following code snippet. Just add this at the beginning of your script. It adds the fetchRecordsWithMatch() function to the form object and presumably does a similar (or better?) thing than fetchRecordsForSearchTerm():

    // form.fetchRecordsWithMatch
    // Returns all records where the specified field matches the given value.
    CDForm.prototype.fetchRecordsWithMatch = function(field_id, value){
        return this.fetchRecords().filter(x => x.getFieldValue(field_id) == value);
    }
    

    And then instead of var auswahlRecoredsMonatsuersicht = formularMonatsuebersicht.fetchRecordsForSearchTerm('2026', feldJahrID); use var auswahlRecoredsMonatsuersicht = formularMonatsuebersicht.fetchRecordsWithMatch(feldJahrID, '2026');

    This will return a record where all records are an extract match. This is what I have in my TF API Extensions script.

    Viel Spass!

    • This reply was modified 1 day, 1 hour ago by Daniel Leu.

    Cheers, Daniel

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

    #53557
    Steve-Kai Vyska
    Participant

    Hi everyone,

    Sorry to follow up again here,

    I’m trying to load a dataset that I retrieve using fetchRecordsForSearchTerm('2026', feldJahrID). Unfortunately, there doesn’t seem to be any filtering happening at all. No matter what I enter as the search string, I almost always get nearly all records back.

    If I search for “1”, I get 4 records. With “12” or “123”, I get 2 records. If I use “2”, I also get 4 records. Searching for “202” returns 4 records, and with “203” I get 3 records.

    Either I completely misunderstand how the function works—in which case I apologize, because then, as usual, the problem is sitting between the keyboard and the chair—or something is definitely not working correctly here.

    Thanks in advance for any information.

    Steve

    I’ll put the Script here because the Database has 12 MB so I can not upload ist

    function Erstelle_Aktuellen_Monat() {
    
        // Aktuelles Datum ermitteln
            var aktuellesDatum = new Date();
            var aktuellesDatumTag = aktuellesDatum.getDate();
            var aktuellesDatumMonat = aktuellesDatum.getMonth() + 1;
            var aktuellesDatumJahr = aktuellesDatum.getFullYear().toString();
    
        // Formular Monatsübersicht mit benötigten Feldern
            const formularMonatsuebersichtID = 'frm-e1192cd5b1724314b84fa584a02cca51';
            const feldJahrID = 'fld-4c4ca5ba0da744e385e552ab5601fee0';
            const feldMonatID = 'fld-9ccdf4162fed4721adaea441d9ff2d43';
            const feldzugehörigeHausidID = 'fld-6841ad10151b477c86de0396fd186d75';
    
        // Unterformular Zahlungseingänge mit benötigten Feldern
            const formularZahlungseingaenge_id = 'fld-6fc140552dbc4a32a1dc078f7268d6e0';
            const feldMieter_id = 'fld-ca6166213bf94662a7a7e04eff78b0d5';
            const feldWohnung_id = 'fld-330fd8f304094d64bb99ddbfa4f9af8b';
            const feldErwartete_einzahlung_id = 'fld-5f60efaf3c6043f2b008a65de6fd47c6';
    
        // Formular Mietvertrag
            const formularMietvertrag = 'frm-556cccd18f174e20982227e870784b87';
            const feldMietvertragMieterID = 'fld-f9505864e6c048079fee1f640d13ba23';                               // formatierter Name des Mieters
            const feldMievertragWohnungID = 'fld-6779828c393c46dfb1e6d547b4c75f8d';                               // Formatierte Whung (Haus + Wohnungsnummer)
            const feldMietvertragDatumBeginnDesMietverhältnissesID = 'fld-7a5d9c2d2dd140fd85ebb7c4e7996fff';      // Ab wann gilt der Mievertrag
            const feldMietvertragDatumEndeDesMietverhältnissesID = 'fld-af2bf0064540430d8c070d138a9a3ba3';        // Gilt dieser Vertrag noch
            const feldMietvertragWarmmieteID = 'fld-1562739d1b1144c7ad250a0e7b379080';                            // Das müsste auf dem Kontoauszug erscheinen
            const feldMietvertragNebenkonstenSummeID = 'fld-3e8a8d04ce1944fb8eac5db9ede21391';                    // Nebenkosten die mit gezahlt wurden (zur Gewinn berechnung benötigt)
    
        // Weitere Variablen zum verarbeiten
            var datensatzErstellt = 0;
    
        // Monatsübersicht öffnen
        console.log("Hole das Formular Monatsübersicht");
            var formularMonatsuebersicht = document.getFormWithId(formularMonatsuebersichtID);
    
        // Alle Datensätze holen, welche dem aktuellen Jahr entsprechen
            console.log("Lese die Datensätze, für das Jahr: " + aktuellesDatumJahr);
            var auswahlRecoredsMonatsuersicht = formularMonatsuebersicht.fetchRecordsForSearchTerm('2026', feldJahrID);
    
        // Kontrollieren ob es Datensätze gibt
            console.log("Kontrollieren ob es Datensätze gibt");
            if (auswahlRecoredsMonatsuersicht.length == 0) {
                // Es liegen keine Datensätze für das Jahr vor
                    console.log(auswahlRecoredsMonatsuersicht.length + " Datensätze gefunden");
    
                // Da keine Datensätze für das Jahr vorliegen, kann für das aktuelle Haus ein Datensatz ertellt werden
            } else {
                // Es liegen Datensätze für das Jahr vor
                    console.log(auswahlRecoredsMonatsuersicht.length + " Datensätze gefunden");
    
                  // jetzt kontrollieren, ob diese auch für das aktuelle Haus sind
                    console.log("Kontrollieren ob einer für das ausgewählte Haus ist");
                        for (var index = 0, count = auswahlRecoredsMonatsuersicht.length; index < count; index++){
                    		if (auswahlRecoredsMonatsuersicht[index].getFieldValue(feldzugehörigeHausidID) == record.getFieldValue(feldzugehörigeHausidID)) {
                                // Für das Haus gibt es bereits einträge
                                console.log("Einen Eintrag gefunden: " + auswahlRecoredsMonatsuersicht[index].getFieldValue(feldJahrID));
                                datensatzErstellt = 0;
                            } else {
                                // Für das Haus geibt es keine Einträge
                                console.log("Haus nicht gefunden");
    
                                // Neuen Datensatz erstellenb
                                datensatzErstellt = 1;
                            }
                    	}
            }
    //    document.saveAllChangesAndRefresh();
    }
    #53548
    Brendan
    Keymaster

    Hi Fernando,

    I think that might be an iOS 26 issue. Script ordering is in both Tap Forms 5 and Tap Forms Pro on iOS, but for some reason it’s not working for me in either version. I’m on iOS 26.2.

    I’ll take a look into it in Tap Forms Pro to figure out why it’s not working.

    Thanks for bringing this to my attention.

    Brendan

    #53546
    Fernando Duran
    Participant

    Hello Brendan,

    I am writing to you again about the issue of script ordering in Tap Forms. I have many, with all kinds of reports, and in Tap Forms 5 with my iPhone I have no problem ordering them.

    But it’s a feature you haven’t introduced in the new Pro. And it is very necessary for me. I guess I won’t be the only one this happens to.

    I don’t have a Mac, which is very expensive in my country, so I can’t do it from my computer.

    For this reason alone I continue using Tap Forms 5, although I want to switch to the Pro, but not having this utility that I use so much is making me delay it.

    For all of these, I would greatly appreciate it if you included this issue in an upcoming Pro update.

    Thank you very much and greetings.

    #53542

    In reply to: working with fractions

    Daniel Leu
    Participant

    Hi Patrick,

    I’ve been using a helper script for a year or two so I can use fractions in my woodworking forms. Your post finally motivated me to bundle everything together in an example form and document how to use it.

    Here’s the link: https://lab.danielleu.com/tapformspro/tips-tricks/index.html?p=Using-fractions

    Hope this helps!

    Cheers, Daniel

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

    #53541
    Brendan
    Keymaster

    var copyRecords = document.getFormNamed('Form 1').fetchRecords();

    Check the API docs for Tap Forms Pro:

    https://www.tapforms.com/help-mac/pro/en/topic/javascript-api

    #53540
    Steve-Kai Vyska
    Participant

    Hello everyone,

    sorry I’m giving up. What I’m trying to do is simple. I have a form, wich is not linked, and I want to get the records to do searches in it.

    According to everything I found this is done Very easy:

    var copyRecords = document.getFormNames(‘form1’).getRecords();

    when I try this, get an Error

    TypeError: copyDummy.getRecords is not a function. (In 'copyDummy.getRecords()', 'copyDummy.getRecords' is undefined), line:(null)

    my next try was to separate it:
    var copyForm = document.getFormNamed(‘form1’);
    var copyRecords = copyForm.getRecords();
    same Error

    going through the javascript doku on the support page I found

    var copyRecords = document.getFormWithId(form1_id);

    but I can not find a possibility to loop the records.

    I think I’m thinking something wrong here but I do not get what.

    Thanks for all hints

    #53526

    In reply to: Import from Evernote

    Daniel Leu
    Participant

    That’s something I have been thinking about for a while. The issue is that Evernote contains unstructured data whereas with TFP, data is structured.

    If you have just a description of your sewing patterns and a photo or two, then that would be much easier than my mix of tables, list, images, etc. A photo attachment field can contain more than one image. So one field is enough.

    There are several online tools that convert enex files to CVS or Markdown. I haven’t looked at them so far.

    For me, I’ll most likely use a Markdown format so I can continue the format I’m used to. The issue I have is the photo tag which doesn’t work directly inside TFP, but works using an external browser as a display. Maybe I’ll find a solution one day.

    Good luck!

    Cheers, Daniel

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

    #53522

    In reply to: Documenter. script

    Daniel Leu
    Participant

    Database scripts don’t exist. You can have form or field scripts. A form script can be made accessible to other form views by classifying it as a document script.

    For the API calls, I would try to tell ChatGPT that this is for Tap Forms Pro and not Tap Forms 5. Maybe it will then use the proper functions (eg, fetchXXX() instead of getXXX()). You can find the API documentation over at https://www.tapforms.com/help-mac/pro/en/topic/javascript-api.

    Cheers, Daniel

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

    #53521
    john bluma
    Participant

    I was trying CHATgpt to generate a script to list the properties of the forms im my database.
    The form below is the output of CHATgpt.

    when I try rund the script the following error appears:

    2/1/26, 11:47:40 AM / Property / listAllFormPropertaiesDB
    listAllFormPropertaiesDB: TypeError: document.getForms is not a function. (In ‘document.getForms()’, ‘document.getForms’ is undefined),
    line:(null)

    CHATgpt says this script should be a DATABASE script, not a FORM script, but I can find no way to create a Database script or to move tghis
    script to become a Database Script. Is there such a way?

    function listAllFormPropertiesDB() {

    var output = [];
    var forms = document.getForms();

    for (var f of forms) {

    output.push(“==================================================”);
    output.push(“FORM NAME : ” + f.getName());
    output.push(“FORM ID : ” + f.getID());
    output.push(“RECORDS : ” + f.getRecords().length);
    output.push(“FIELDS : ” + f.getFields().length);
    output.push(“”);

    var fields = f.getFields();

    for (var fld of fields) {

    var line = [];
    line.push(” Field Name : ” + fld.getName());
    line.push(” Field ID : ” + fld.getID());
    line.push(” Type : ” + fld.getType());

    if (fld.isCalculationField())
    line.push(” Calc : YES”);

    if (fld.isScriptField())
    line.push(” Script : YES”);

    if (fld.isTableField())
    line.push(” Table : YES”);

    output.push(line.join(” | “));
    }

    output.push(“”);
    }

    return output.join(“\n”);
    }

    listAllFormPropertiesDB();

    #53517
    Steve-Kai Vyska
    Participant

    Hello everyone,

    I think I’ve found an error in the grouping function of the records.

    When you open the “Zimmer” form in my database and set the value to 1 under form details at Other / Single-column list view fields, and then choose no restriction for the fields to be displayed, the list shows the field to be sorted as the main heading — in my case, the name of the apartment — and below that the floor. After that, an empty line appears and then a dash indicating that a new entry follows.

    So far, everything is fine.

    However, if you then set Other / Single-column list view fields to 2 in the detail settings and reload the overview, the following is shown:
    The main heading with the field to be sorted
    The name of the apartment
    The floor
    <the empty line that previously separated everything together with the dash from the next record>
    The room description
    <the dash separating the next record>

    Is this intended behavior? Especially in “dark mode”, the empty line above the dash is very helpful for visually separating the records from each other.

    I wish you all a wonderful weekend.

    Attachments:
    You must be logged in to view attached files.
    #53506
    jessica hardy
    Participant

    Hi there,
    I’ve used tap form LT since 2010 and today went to check some saved data only to find I can’t access the app. I tried all sorts and deleted app only to find I couldn’t reload as no longer in store. I restored my entire iPhone to get it back. I still can’t access the app and quote desperate to get at my data at this stage. How can I access all the data from LT and get into pro or 5? I have paid the subscription but I am unable to do anything and desperately need the data. Please please someone help.

    Many thanks Jessica

    #53505
    jessica hardy
    Participant

    Hi there,
    I’ve used tap form LT since 2010 and today went to check some saved data only to find I can’t access the app. I tried all sorts and deleted app only to find I couldn’t reload as no longer in store. I restored my entire iPhone to get it back. I still can’t access the app and quote desperate to get at my data at this stage. How can I access all the data from LT and get into pro or 5? I have paid the subscription but I am unable to do anything and desperately need the data. Please please someone help.

    Many thanks Jessica

    #53503

    In reply to: Can’t export

    karen james
    Participant

    I’m finding myself feeling as Russell does. We’re 4 months away from the 1 year anniversary of the release of Tap Forms Pro and it seems that the only new things have been added to the Mac version, which I will not subscribe to. Most of the updates have been bug fixes. For me, there is no incentive to maintain my subscription.

    • This reply was modified 2 weeks, 4 days ago by karen james.
Viewing 15 results - 1 through 15 (of 3,008 total)