Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Sorting by date in a self-join relationship?


This topic is 4562 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

In my current solution I have a sorting script that enables users to sort by date (for a date field) but I just can't figure out why, in a self-join relationship, I can't get the dates to sort within the portal; the sorting script works fine when queueing records to print, it's only within the portal I can't get the records to sort. I disabled the "Sort Portal Records" checkbox within the portal so that's not locking the sort into one direction or the other.

Am I missing something, or...?

Posted

The order of related records needs to be set either in the relationship's definition or in the portal setup. Sorting found records has no effect here.

See also:

http://fmforums.com/forum/showtopic.php?tid/202466/

Posted

Tabs? I never would've thought of that. Very clever!

Thanks again for your help!

  • 6 months later...
Posted

The order of related records needs to be set either in the relationship's definition or in the portal setup. Sorting found records has no effect here.

Does this explain why trying to add a sort step in a GTRR script has no effect?

(I use a scripted button to bring up a related table with records related to the line in the portal, in a new window, but i cant get the records in the new window to sort with the script... ???)

Posted

@cbum - You should be able to gtrr new window in a list view and sort.

I'm not opening into a list view - does that matter?

I'm simply using GTRR to pull out the related records in the second table. I correctly land on the record I had clicked on in the starting portal in the first table, but the records in the new window with the found set of related records is unsorted, and adding a sort step to the script has no discernible effect... why?

(I would like to sort the records by date, so that if necessary, one can read additional records chronologically)

Posted

What is the view in the new window if it's not a list view? What do you mean by "pull out" the records? How can you land on the record in the portal if you are gtrrs? You said, "related table with records related to the line in the portal," which to me, means child records of the visible portal record.

Perhaps you should post your script and a description of the functionality you require.

Posted

I'm not opening into a list view - does that matter?

No.

the records in the new window with the found set of related records is unsorted,

Actually, it is sorted in the same order as defined for the relationship (which may be none).

adding a sort step to the script has no discernible effect... why?

That is the weird part here, since it should work. The only thing that comes to mind is that you may be trying to sort by a field from another TO of the table.

Posted

This is the simple script attached to the button, which is in the portal row, ie repeated on all rows visible in the portal window:

Go to Related Record [show only related records; From table "EPR"; External: Using Layout: "EPR" (EPR); New Window]

Sort Records [Restore; No dialog]

The initial layout "External Data" has a portal linked to the related table "EPR" in a one-to-many relation.

After clicking the button, The related table comes up in a new window, with just the related records "found", and the record clicked on in the portal is the one open in the second window. But the found set is unsorted, so navigating to other related records is random instead of sorted by date.

The portal itself is sorted by date.

I have tried with and without a sort by date defined in the relation, no change in behavior.

I really wonder what I am missing here.

Posted

Go to Related Record [show only related records; From table "EPR"; External: Using Layout: "EPR" (EPR); New Window]

Are you switching to another file here?

Posted

Are you switching to another file here?

correct.

Does that make a difference?

Posted

Does switching to another file matter? Yes.

You describe a script in file A:

Go to Related Record [show only related records; From table "EPR"; External: Using Layout: "EPR" (EPR); New Window]

Sort Records [Restore; No dialog]

But the sort operation in that script cannot work because you are no longer in file A. You would need to place the sort script in file B and the file A script would call the sort script in file B.

Posted

Does switching to another file matter? Yes.

You describe a script in file A:

Go to Related Record [show only related records; From table "EPR"; External: Using Layout: "EPR" (EPR); New Window]

Sort Records [Restore; No dialog]

But the sort operation in that script cannot work because you are no longer in file A. You would need to place the sort script in file B and the file A script would call the sort script in file B.

Thanks, that was what I was missing ;-)

This topic is 4562 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.