Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Linked forms question
- This topic has 2 replies, 2 voices, and was last updated 3 years ago by Steven Daniel.
-
AuthorPosts
-
December 3, 2021 at 8:50 AM #45935
Steven DanielParticipantAnother newbie question.
I have created a LINKTOFORM field in a form called NewSLC to a form called township. Joined them so value in a field called Number (NO) matches in each.
What I want to do is a search for all the records that have an X (tick mark) in a field (called ManyOaks) – (screenshot is from form Township) and be able to see those records in SLC and output them in a SLC layout. I assume this needs to be done by a script in a new script field, but I need help here. But maybe there is a way do it that doesn’t use a script.
Attachments:
You must be logged in to view attached files.December 4, 2021 at 3:34 AM #45943
Sam MoffattParticipantAre the entries in NewSLC mapped to a single Township or is a single Township linked to multiple NewSLC?
The challenge with “many” side relationships (1:M from the parent, M:M or JOIN) is that by definition there is the potential for multiple records to be linked. If more than one Township is linked, does it matter if only one record is ticked or do all records need to be linked?
If you can use a Link to Form 1:M field instead of the JOIN and there is only ever a single township linked to a NewSLC record then you can solve this using a calculation field to copy the value to make it available for a saved search.
Otherwise you need to use a script field to iterate over all of the potential records. This is actually the same pattern as the previous form post: we’d use the child records loop with the “ManyOaks” field selected. Then inside the
if
statement, we change// do something
to bereturn "X";
. Saving that and updating the records should include an “X” if any of the records linked have that value set.December 4, 2021 at 10:26 PM #45957
Steven DanielParticipantThanks for this, Sam. Somehow I never saw your response until just now. Yes – it did need a script field. Brendan helped me a ton with that and just as you suggested, used the child records loop. It worked perfectly. I have a steep learning curve with this scripting! Thanks again for your help.
-
AuthorPosts
You must be logged in to reply to this topic.