Sorting on Linked Field

Viewing 1 reply thread
  • Author
    Posts
  • February 24, 2022 at 9:28 AM #46872

    Alan Hayman
    Participant

    Hi,
    I have two forms that I connected with a Join link. I want do a sort in Form A, and I would like one of the sort parameters to be a value that is in a field that appears in Form A, but it originates in Form B and is displayed in Form A through the Join link. When I access the sort parameters dropdown menu, the field that I brought over through the link doesn’t appear. Is there any way to have this field be one of the sort parameters?
    Thanks!

    February 24, 2022 at 12:51 PM #46874

    Brendan
    Keymaster

    Hi Alan,

    There’s no direct way to sort on fields that are in related forms.

    But you could pull out the data from your Join field to display it in the parent form. You’d need a script to do that though. And because a Join field is a many to many relationship, you could possibly have multiple values in that field. So you would need to build up a string that concatenates all of the values and then sort by that on the parent form.

    Or if you’re only interested in the first value of the relationship, you could just pick out the first value from that field.

    Here’s information on scripting:

    https://www.tapforms.com/help-mac/5.3/en/topic/scripts

    On the Script Edit screen there are snippets. One of them is called Child Records Loop. If you select a field from your Link to Form field, then double-click on the Child Records Loop snippet, Tap Forms will write the code for you that you would need to loop through all the records of the Link to Form field. You would then just need to augment that with code to concatenate the values from the field into a single string. Then you can sort your parent form by that Script Field.

    Hope that makes sense.

    Thanks,

    Brendan

Viewing 1 reply thread

You must be logged in to reply to this topic.