Documenter. script

Viewing 2 reply threads
  • Author
    Posts
  • February 1, 2026 at 10:57 AM #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();

    February 1, 2026 at 11:33 AM #53522

    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

    February 2, 2026 at 10:19 PM #53530

    Brendan
    Keymaster

    I unfortunately had to rename the getXXX() functions to fetchXXX() due to a conflict with naming when I switched to using CoreData for the database engine.

Viewing 2 reply threads

You must be logged in to reply to this topic.