Using Generated Record IDs to Create Filter-Like Subform Views in Tap Forms pro

Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch Forums Script Talk Using Generated Record IDs to Create Filter-Like Subform Views in Tap Forms pro

Viewing 0 reply threads
  • Author
    Posts
  • May 2, 2026 at 9:40 AM #54035

    Steve-Kai Vyska
    Participant

    I solved a Tap Forms limitation by using a generated technical code to separate linked records by status, even though I could not apply an extra filter directly inside the relationship.

    Example:
    A Unit / Apartment should show

    active Lease Agreements
    archived Lease Agreements
    separately.

    Idea
    Each Lease Agreement gets a calculated field called something like Display Code.

    That code consists of:

    a status prefix
    plus the RecID of the linked unit
    For example:

    A.rec-123… = active agreement
    N.rec-123… = inactive / ended agreement
    Step 1: Expose the unit’s own RecID
    In the Unit form, create a script field that returns the record’s own ID:

    function UnitRecID() {
    return record.getId();
    }
    UnitRecID();
    Step 2: Read the linked unit RecID inside the lease agreement
    In the Lease Agreement form, create a script field that reads the RecID from the directly linked unit:

    function LinkedUnitRecID() {
    var unit;

    unit = record.getFieldValue(‘UNIT_FIELD_ID’);
    if (!unit || !unit.length) {
    return ”;
    }

    return unit[0].getId();
    }
    LinkedUnitRecID();
    Step 3: Build a calculated display code
    In the Lease Agreement form, create a calculated field such as:

    IFEMPTY( Lease End Date ; “A.” ; IF( Lease End Date < TODAY() ; “N.” ; “A.” ) ) + Linked Unit RecID
    Result:

    A.rec-123…
    N.rec-123…
    Step 4: Use separate linked views in the unit
    Now the Unit form can have separate linked fields / subform views for:

    active lease agreements
    archived lease agreements
    Important note
    Do not create new lease agreements through the filtered view.

    Instead, create them through a normal unfiltered subform like:

    All Lease Agreements
    That way the direct relationship to the unit is set first, and the technical fields can calculate correctly afterward.

    This approach worked well for me when I needed different “views” of the same linked records, but Tap Forms could not apply the additional filtering logic directly inside the relationship.

    Perhaps someone need this too.

    C ya

    Steve

Viewing 0 reply threads

You must be logged in to reply to this topic.