Using Subforms

Viewing 7 reply threads
  • Author
    Posts
  • July 7, 2025 at 12:36 PM #52630

    Steve-Kai Vyska
    Participant

    Hello everyone,

    i was looking for a Databalse on Mac that was something like Access or filemaker and I must say that I love this one. It is easy and works great.

    But I got one Question. From both other programs I was used to connect the Date via IDs. That was great so you could use cascade forms. Is there something like that possible in Tab forms pro.

    I.E.

    I want to make a Databalse for tenants. For that I have three Forms:

    1. House (general Data from the House like Adress etc
    2. Apartment (floor, Kitchen etc.)
    3. Tenant

    The Apartment form has the tenant as sub form. That works great. The House form has the apartment form as subform, which also works great without the need to edit something spezial.

    But:

    When I open the house form, I get shown the right apartment-data but the last field, which is shown because of the Tenat form is empty. is it possible to show some data here?

    Sorry for my English I’m from Germany. so this is not very good.

    Thanks for any help

    Steve

    Attachments:
    You must be logged in to view attached files.
    July 7, 2025 at 5:20 PM #52639

    Daniel Leu
    Participant

    That has always been a challenge to show data that is coming from a linked form that is linked to another form. But thinking about this again, I found a solution :-)

    First, you have to enable ‘show reverse relationship’ on all linked fields.

    Then, in the house form, add a field script that returns the record id of the house record (house_id). Then in the tenant form, add another field script that returns the record id of the house record (house_id). To do this you have to traverse the linked fields back to the apartment and then to the house.

    Now in the house form, change the tenant linked field type to ‘joined’ and use the two house_id fields to link the two form.

    Now you can see all the tenants and can directly select them in the house form. When creating a new tenant or assigning one, you might have to click ‘refresh records’ to get the updated data!

    Please have a look at the attachment that shows this functionality at work.

    Another approach would be following:
    In the apartment form, add a field script that returns the name of the tenant:

    function tenant() {
    
        const mieter_id = 'fld-3bad25ed396f42e49da9780dd86d1920';
    
        const mieter__name_id = 'fld-a255f473fd744c398134add2a87a3cc9';
        const mieter__vorname_id = 'fld-ba1a0292eb07418fae85a894f94d6670';
    
        let mieter = record.getFieldValue(mieter_id);
    
        if (!mieter || mieter.length == 0) return '';
    
        // use first tenant
        mieter = mieter[0];
    
        // get names
        const name = mieter.getFieldValue(mieter__name_id);
        const vorname = mieter.getFieldValue(mieter__vorname_id);
    
        // return name
        return vorname + " " + name;
    }
    
    tenant();

    Then add this field in the apartment listing of the house. This way, you see who’s in which apartment, but you don’t have the direct link in the tenant table.

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

    Cheers, Daniel

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

    July 9, 2025 at 10:16 AM #52657

    Steve-Kai Vyska
    Participant

    Thanks for the solution, I’ll need some Time to understand it / look in the File you send. Thanks for the Hel.

    Steve

    July 9, 2025 at 12:06 PM #52658

    Daniel Leu
    Participant

    The idea is to link the tenant to the house using the join relationship with the record id of the house as the connecting element. Each record has an id, but it has to be exposed first. For the tenant it’s a bit more complicated since the house id first has to be found.

    Cheers, Daniel

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

    September 4, 2025 at 8:55 AM #52929

    Steve-Kai Vyska
    Participant

    Thanks for the Help, I just found out how to use it, but now I got a new Question. When I Use Subforms, I can activate “Umkehrbezihung einblenden”. Using this, I get one of the Filed shown, from the SubForm, but I can not figure out, which one is shown there?

    Could someone tell me how I can select which one is shown, or how to make a subform the way, that the field I want to show is the selected field.

    Sorry I guess the question is silly and to normal user logial, but I do not get it.

    Greetings

    Steve

    Attachments:
    You must be logged in to view attached files.
    January 10, 2026 at 6:10 AM #53425

    Steve-Kai Vyska
    Participant

    Hi,

    I put up this Threat again because I still did not found any solution

    in the File I attached you can see what I mean, in the first sub-form i.e. the Fields Mieter are not listed. same in the second one called “mietverträge”

    Would be great if someone could tell me what I’m doing wrong there.

    Regrets

    Steve

    Attachments:
    You must be logged in to view attached files.
    January 12, 2026 at 4:37 PM #53431

    Daniel Leu
    Participant

    The content of the field Mieter in the field Mietvertrag in the form Häuser Überblick is not listed because it links to another sub-form instead of being a simple value.

    What you can do is create an additional field named Mieter Name(n) of the type script in the Mietvertrag form. Then use following script code:

    function Mieter_Name_N() {
    
        const mieter__name_id = 'fld-ea8902723e1d4656b93115e3e9f3dd80';
        const mieter__vorname_id = 'fld-5eef0854c09746dd8ae8838d90ec2d6d';
    
        const mieterRecs = record.getFieldValue('fld-8b3ff793448e47e38ff077e3c1b2c932');
    
        // loop over all mieterRecs
        let mieters = [];
        for (mieterRec of mieterRecs) {
            let name = mieterRec.getFieldValue(mieter__name_id);
            let vorname = mieterRec.getFieldValue(mieter__vorname_id);
    
            mieters.push(vorname + " " + name);
        }
    
        return mieters.join(', ');
    
    }
    
    Mieter_Name_N();
    

    It combines the first name and the name of each renter and then joins them as a coma separated list. Now all you have to do is update the Mietvertrag table view in the main form and add this newly created field. Now the renters are listed.

    Hope this helps! Sonst kannst du mir auch in Deutsch schreiben. Viel Spass!

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

    Cheers, Daniel

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

    January 13, 2026 at 10:21 AM #53433

    Steve-Kai Vyska
    Participant

    HI Daniel,

    that’s a good idea. I was thinking of something like that, and was wandering, if there is no easier solution :)

    Thanks for the Code, I’ll put it in my Database

    Cheers

    Steve

Viewing 7 reply threads

You must be logged in to reply to this topic.