7 Replies Latest reply on May 29, 2012 4:17 PM by philmodjunk

    Portal row refresh sorting

    RedL

      Title

      Portal row refresh sorting

      Post

      I use Refresh Windows, Flush cashed join result; Flush external data, to refresh portal row sorting after adding new rows.  But, it does not work.  It works only when I save the record.  My layout has an invisiable web view on the backgroud which disable the real time record save feature.  Record will be saved only when user click "Save" command.

      How can I refresh the portal row sorting before it is saved?

        • 1. Re: Portal row refresh sorting
          Sorbsbuster

          Courtesy of Phil:

          Include in your relationship for that portal a cartesian join of some text field, like:

          gTextFile X AnyOldField

          and in the save script, set the gTextField to itself.

          • 2. Re: Portal row refresh sorting
            RedL
             I have ID =  ID relationship.  It works.  On my save script the sorting works perfectly also.  But, I need the portal rows to be sorted BEFORE save.
            • 3. Re: Portal row refresh sorting
              Sorbsbuster

              Sorry, don't understand.  How can the file sort something based on data it hasn't seen yet?  You could trigger a re-sort after you create each row with a ScriptTrigger, presumably.

              • 4. Re: Portal row refresh sorting
                RedL

                Yes, I did.  I triggered re-sort script, by using Refresh Windows, Flush cashed join result; Flush external data, when a new line has been entered.  But the commit is not trigged, because I have a web viewer on the background which prevent the parent and portal record save automatically and I can revert it.

                • 5. Re: Portal row refresh sorting
                  philmodjunk

                  You're in a bit of a catch 22 here. You need to commit the record so that the sort can take place, but can't commit the record without also committing the parent record and then you can't simply revert the record to undo the data entry changes.

                  I think you'll need to redesign your layout, tables, relationships, etc so that you have a way to revert your data without using FileMaker's built in Revert option.

                  You can capture the original value of fields in global fields or variables when you enter the field to change it.

                  You can design a layout based on global fields and use a "save" script to copy the data from the global fields into a new or existing record.

                  • 6. Re: Portal row refresh sorting
                    RedL

                    I see and thanks.  

                    It comes to my mind for two ways to implement own revert.
                    1. Use global variables and/or fields. It should not be problem to use global variables and/or fields for general fields.  But, nothing come to my mind for the portal row implementation.  Any suggestion for portal rows info?
                    2. By duplicating parent and children records(portal row) with temporary primary key to link both temporary parent and temporary children together for editing.  When Save command is clicked, copy all  temporary parent and temporary children to original record.  When Revert command is clicked, discard temporary records.
                    Comments are very welcomed.
                    • 7. Re: Portal row refresh sorting
                      philmodjunk

                      I can't really suggest much without knowing more about the portal. What is the current relationship that you have? You can set up a relationship where the field on the parent side is a global field, but you still have the issue of reverting records with the portal's records.