2 Replies Latest reply on Mar 3, 2009 9:08 AM by gsainc

    IWP sort script truncation

    gsainc

      Title

      IWP sort script truncation

      Post

      I have a very simple sort script set to sort a list view database. This works great in the standeard non-shared solution however when I open the solution via IWP the sort script truncates my list. I am sure that sorting can be done with IWP but something is going wrong here.

       

      This is a sample script - this is used in list view on the table "Advetisments"

       

      sort_due
      If [ Advetisments::sort ≠ "dueup" ]
      Set Field [ Advetisments::sort; "dueup" ]
      Sort Records [ Specified Sort Order: Advetisments::due_date; ascending ][ Restore; No dialog ]
      Exit Script [ ]
      End If
      If [ Advetisments::sort ≠ "duedn" ]
      Set Field [ Advetisments::sort; "duedn" ]
      Sort Records [ Specified Sort Order: Advetisments::due_date; descending ][ Restore; No dialog ]
      Exit Script [ ]
      End If





        • 1. Re: IWP sort script truncation
          gsainc
             I have looked into it a bit more and found that the error occurs specifically with a descending sort order on any given field. Additionally the test I ran was to make a button with a single script step. Sort Records[Restore; No dialog] - - the sort, when sorting by record ID / descending, via IWP does not sort, instead it cuts off all but one record.
          • 2. Re: IWP sort script truncation
            gsainc
              

            I found a fix - hopefully this will help other people with the same issue.

             

            When using IWP filemaker goes to the record that is first in the sort order. For example if I sort by a field for which record #4 comes to the top, filemaker also "goes to" that record. This is fine normally but it is a problem with IWP. The problem arises because IWP removes all records that come before #4. So on that script the list was truncated by removing record 1,2 & 3. anyway here is the fix:

             

            sort_due
            If [ Advetisments::sort ≠ "dueup" ]
            Set Field [ Advetisments::sort; "dueup" ]
            Sort Records [ Specified Sort Order: Advetisments::due_date; ascending ][ Restore; No dialog ]
            Go to Record/Request/Page [First]
            Exit Script [ ]
            End If
            If [ Advetisments::sort ≠ "duedn" ]
            Set Field [ Advetisments::sort; "duedn" ]
            Sort Records [ Specified Sort Order: Advetisments::due_date; descending ][ Restore; No dialog ]
            Go to Record/Request/Page [First]
            Exit Script [ ]
            End If

             

            The change being:
            Go to Record/Request/Page [First]
            placed after each sort script step