4 Replies Latest reply on Jan 15, 2015 7:19 AM by Stu412

    Sort and filter a list view dynamically



      Sort and filter a list view dynamically


      Hi there

      I've got a whole bunch of project records on a list view and each project has an assignment to a member of staff.  In addition, it has a status, such as started, waiting on customer, on hold etc.

      Given that in time there will be hundreds of these, and given that I'm not displaying them in a portal (because the layout I'm using is most closely linked to the table where the information is)...

      How can I set sort and filter options on this report which respond to user inputs in the same way that normal ERP software would do?

      For example, to sort by staff name, I'd like to click an A-Z icon.

      To filter by staff name, I'd like to be able to select from a dropdown (or popup) and hit a Go button.

      I've searched around for this and cannot find a post which describes this specific task so I feel it may be a case of several smaller tasks coming together at once.

      Thanks in advance.

        • 1. Re: Sort and filter a list view dynamically

          You can manually perform a find or sort records on one or more fields.

          You can create scripts that do the same.

          You can set up a button or a script trigger on a global field set up with a drop down list to perform those scripts.

          Thus, an OnObjectSave or OnObjectModify trigger on a global field formatted with a drop down list or pop up menu can perform a script similar to the examples found here: Scripted Find Examples

          Sorting via button click is even simpler as you need only specify a single step: Sort records (or sort records by field) and then you specify the details needed for either of those script steps. The sort records script step uses the same dialog you use to manually sort records.

          Both of these techniques have been discussed in this forum  in many different threads...

          • 2. Re: Sort and filter a list view dynamically


            This rocks! Brillant, thank you.

            • 3. Re: Sort and filter a list view dynamically

              Hi Phil

              I'm enjoying this one and having success with the script below which you kindly pointed me in the direction of:

              Set Variable [$Year ; value: Globals::gYear ]
              Enter Find Mode []
                 Set Variable [$V ; Value: $V + 1 ]
                 Set Field [FinData::YearEnd ; GetValue ( $Year ; $V) ]
                 Exit Loop If [ $V > valueCount ( $Year ) ]
                 New Record/Request
              End Loop
              Set Error Capture [on]
              Perform Find[]

              I've created a list report with a sub summary based on the FinData::YearEnd field referred to here.  The year data itself is purely a number, 2012, 2013, 2014 etc and displays annual figures per customer.  What I want to do is show only the sub-summaries which are selected in the check box at the top of the page, so my users can select all customers annual figures for say, 2012.  The check box is pulling data directly from the FinData::YearEnd field as well.  

              At the moment, when I select any year, everything goes from the report...and won't come back unless I manually Show All and re-sort the found set.  

              Are the sub-summaries throwing a spanner in the works here?



              • 4. Re: Sort and filter a list view dynamically

                Ah, answered my own question - I put a sort function on the end of the script which is the same sort function for the view in general and now it's returning data :)