2 Replies Latest reply on Jun 24, 2011 12:27 PM by Erik,

    How to sort portal by related record field?

    Erik,

      Title

      How to sort portal by related record field?

      Post

      Hi,

      I have 3 tables: 'Part', 'Assembly' and 'AssemblyPart'. AssemblyPart has foreign keys to Part::ID and Assembly::ID, so we can have many assemblies that consist of many parts. On layout Assembly I have a portal to AssemblyParts, one of the fields in the portal is Part::Name from the related table Part. 

      How can I sort (by using a script) the portal by Part::Name?

      Thanks, Erik

        • 1. Re: How to sort portal by related record field?
          philmodjunk

          You can't sort a portal by script except if you use it to change a field value in one form of a "sorting portal" trick that doesn't seem to apply here.

          You can, get your records to sort by part name I think, but it takes an extra field. Try this method and see if it works for you:

          Define a calculation field in AssemblyPart. enter Part::Name as the sole item in its calculation and set it to return text as it's return type.

          Open portal setup... and specify this new calculation field as the field on which to sort items in the portal.

          • 2. Re: How to sort portal by related record field?
            Erik,

            Hi PhilModJunk,

            That seems a good solution for this problem, I will try it...

            Thanks, Erik