12 Replies Latest reply on Jul 11, 2013 11:15 AM by deathrobot

    This is a question about portal sorting based on a demo from fmforums.com:...

    deathrobot

      Post

           This is a question about portal sorting based on a demo from fmforums.com:

            

           http://fmforums.com/forum/topic/83953-portal-sorting-with-fm12/

            

           Unfortunately the topic is locked over there, and since I've had so much good advice from this forum, I thought I'd ask here. I'm having trouble getting this particular file to work in my solution, so I guess this question is just for people who have downloaded and worked with this file (or who might be interested in downloading it). Still reading…?

            

           First, the portal I am trying to sort is a self-join using a cartesian join. Not sure if that affects this or not. My setup is:

            

           • A table called "Competitrack"

           • On the graph, one parent TO of Competitack, called "Competitrack" and 1 child TO of Competitrack called "CompetitrackAllPortal » Competitrack". Related using a cartesian join (using the field "id").

           • The portal is on a layout based on the table Competitrack, and the portal itself is based on the CompetitrackAllPortal » Competitrack TO

           • For the SQL script step, I've tried every combination I can think of, but the one that seems like it's the most correct is:

            
           ExecuteSQL (
                "SELECT
                     id
                FROM
                     Competitrack // not sure if this should be the table name or the TO name (i.e. "CompetitrackAllPortal » Competitrack"…
                WHERE
                     id = ?
                ORDER BY"
                     & $field & Case ( $$sort_desc; " DESC" );
                "";
                "";
                Competitrack::id
           )

            

           • The button I'm using calls the script "Portal Sort ( field )" with the parameter "Let ( $$sort_icon = 2; GetFieldName ( CompetitrackAllPortal » Competitrack::adTitle ) )." (adTitle is the field I'm trying to sort on).

           • The portal is sorted on the "zzc_portal_sort" field which is evaluated from the context of CompetitrackAllPortal » Competitrack.

            

           I realize this is a longshot, but if anyone has some insight into what I'm doing wrong here, I'd really appreciate the feedback.

            

           Thanks,

           Michael