1 Reply Latest reply on Mar 27, 2014 4:40 PM by jwmickelson

    Hint - Dynamic Sort Challenge and Solution

    davidanders

      Title

      Hint - Dynamic Sort Challenge and Solution

      Post

           Found this on the internets.

      Dynamic Sort Challenge [with video explanation & challenge FP7 database]
      http://www.1-more-thing.com/Dynamic-Sort-Challenge.html

           The challenge was posted on FMForums.  (several people responded with entries)
      http://fmforums.com/forum/topic/84832-dynamic-sort-challenge/

           The solution database FMP12 download
      http://www.1-more-thing.com/Dynamic-Sort-Challenge-Solution.html

        • 1. Re: Hint - Dynamic Sort Challenge and Solution
          jwmickelson

               Just found this on Fabrice's site and here too --- it's a great hack!

               This begs the question, why do we need to resort to a hack like this???  Since there already is an existing xml/text based grammar for defining dynamic Sorts, and it's already in use within FMP in many ways!

               Lets get some developer feedback going to allow us to use this same grammar within FM through the front door, to define a dynamic sort! 

               Below is the text of my recent Feature Suggestion, please make one too, if you feel this is worth having in FMP: 

               FEATURE REQUEST:

               Currently Scripted Sorts must have a hard coded Sort script step for EVERY possible permutation of sort fields needed, to allow any level of dynamic sort capability while still hiding the complexity of true table/field names from the end user.

               FileMaker Pro already has a robust, well defined, and production ready Sort XML grammar that is used by copy/pasted Sort script steps and can be easily seen within the SnapShot link file.  (an example follows below, that uses almost every possible setting in the Sort dialog, and it is not hard to see how these could be easily constructed).
                
               FMI, please add a "Specify..." option to the existing Sort dialog to allow a calculated sort defining xml to be fed into the dialog and have the dialog use that for the sort instead of hard coded sort criteria.
                
               This could allow innumerable new features, uses and UI improvements for developers everywhere, increasing FileMaker's ability to meet dynamic business needs, without impacting "FMP novices" in a negative way.
                
               The Existing FileMaker Pro SORT XML format is as follows:
               ================================
               <SortList value="True">
                
               // ---- EXAMPLE OF SORT BY CUSTOM VALUE LIST ENTRIES, BY VALUE LIST
               <Sort type="Custom">
               <PrimaryField>
               <Field tableId="1065091" table="Expenses" id="64" name="Expense_Type">
               </Field>
               </PrimaryField>
               <ValueList id="2" name="Expense Type List">
               </ValueList>
               </Sort>
                
               // ---- EXAMPLE OF SORT BY DESCENDING VALUE  - WITH A OPTION SUMMARY BREAK FIELD APPLIED
               <Sort type="Descending">
               <PrimaryField>
               <Field tableId="1065091" table="Expenses" id="32782" name="Name_First">
               </Field>
               </PrimaryField>
               <SummaryField>
               <Field tableId="1065091" table="Expenses" id="32789" name="sum">
               </Field>
               </SummaryField>
               </Sort>
                
               // ---- EXAMPLE OF SORT BY ASCENDING VALUE 
               <Sort type="Ascending">
               <PrimaryField>
               <Field tableId="1065091" table="Expenses" id="32771" name="Expenses_Day1">
               </Field>
               </PrimaryField>
               </Sort>
                
               // ---- EXAMPLE OF SORT BY "RELATED FIELD", DESCENDING VALUE - WITH A SORT OVER-RIDE BY LANGUAGE
               <Sort type="Descending">
               <PrimaryField>
               <Field tableId="1065090" table="Expense Report" id="32793" name="Department">
               </Field>
               </PrimaryField>
               <OverrideLanguage language="Dutch">
               </OverrideLanguage>
               </Sort>
                
               </SortList>
               ================================