Link to Form (myself)

Viewing 3 reply threads
  • Author
    Posts
  • February 6, 2017 at 11:33 PM #21074

    Mike Schwartz
    Participant

    I’m experimenting with using a Link-to-Form field in a way that perhaps was not what was envisioned, and getting some peculiar results. I’m trying to relate records that exist within the same form, rather than records from multiple forms.

    I have a custom form named “My Event Log”, which I use to keep track of important household events. One record might contain information about a doctor visit. Another record might contain information from a follow-up phone call a week later. It occurred to me that it would be useful to have an indication that the two records are related to each other.

    So I added a Link-to-Form field and named it “Related Child Records”, linking to the form “My Event Log”, configured as many-to-many, with Show Inverse Relationships enabled. Tap Forms created a corresponding Link-from-Form field, which I named “Related Parent Records”.

    To test it out, I went to my Doctor Visit record, which I consider to be the Parent. In the new Related Child Records Field, I selected the Phone Call record from the check-mark popup list.

    Here’s what I expected (hoped for): The Doctor Visit record would show the related Phone Call record in the link-to field as entered, and nothing in the link-from field. Inversely, the Phone Call record would show nothing in the link-to field, and show the Doctor Visit record in the link-from field.

    Instead, this is what I got: The Doctor Visit record shows the same Phone Call record in both its link-to and the link-from fields. The Phone Call record shows the same Doctor Visit record in both its link-to and link-from fields. Having the double entries like this obscures understanding which record is the parent and which one is the child.

    Any way to get this working the way I’m trying to? I tried unlinking the records, then changing the link type to One-to-Many, and redefining the link. I got the same results with the double entry in each of the two records.

    Thanks for any guidance.

    February 7, 2017 at 12:25 AM #21076

    Brendan
    Keymaster

    Hi Mike,

    Yes, there is an issue with reciprocal relationships to the same form. It was designed to go to different forms actually. However, if you just don’t turn on the Show Inverse Relationship function, then when you double-click on the entry to view the child record from the parent record, the child record will already have its parent added to the same field. So it’s a bit like an automatic inverse relationship. So you don’t need that extra Link From Form field.

    February 7, 2017 at 11:09 AM #21082

    Mike Schwartz
    Participant

    Brendan, thanks as always for the great responsiveness! I tried what you suggested, and it kinda sorta worked. With just a single link between two records, it behaves just as you suggested. But after linking the child record to the parent from within the parent record, I then tried to link the parent record to a second child record from within the second child record. This produced two identical entries in the link-to field of the second child record. I deleted one of the entries and they both disappeared. Then I tried going back to the parent record and adding the link to the second child record from within the parent record. That produce the desired result: each child record shows a single link to the parent, and the parent shows links to both children.

    I’m fine with working around some of the quirks and training myself to do things in a particular way that works. But my concern is this: I’m using a capability in a way that wasn’t intended, and is not a specified feature of the software. If you do some additional development or bug-fix work in this area, it’s possible that my use case might break. And since it isn’t part of what the software was designed to do, it doesn’t seem likely that you’d be regression testing my use case, and really, why should you?

    Am I better off just not relying on an undocumented feature?

    February 7, 2017 at 12:40 PM #21085

    Brendan
    Keymaster

    Hi Mike,

    That’s a good question. The company that makes the database engine that I use (Couchbase Lite) is working on a new version 2.0 which changes a lot of things and I’ll probably need to do a whole bunch of rewriting of the way Tap Forms stores and retrieves its data in order to support it. So I don’t really know what that might bring forth in the future. But I’ll do my best not to break things. Hopefully the worst case scenario for you would be that you’d need to enable the Show Inverse Relationship function to seen the inverse relationship. That’s the way it’s supposed to work anyway.

Viewing 3 reply threads

You must be logged in to reply to this topic.