2 Replies Latest reply: Jun 6, 2013 7:36 AM by Nathan Alard RSS

    QlikView crashing when using Sort Expression

      Good day All,

       

      Any suggestions or solutions are much appreciated.

       

      QlikView Version: Version 11.20.11718.0 SR1 64-bit Edition (x64)

      Issue: QlikView Crahes

      Issue a result of: Selection in Listbox

      Sort Expression for Listbox:

      //****************************//

      If(len(GetFieldSelections(Business_Division))<2,

                Match(Business_Division,

                'Afrikaans',

                'English',

                'Local',

                'Head Office',

                'Shared Services',

                'Digital',

                'Natal Witness Group',

                'Old',

                'Other',

                'Paarl Coldset'

                ),

                If(GetFieldSelections(Business_Division)='Afrikaans',

                          Match(Business_Division,

                          'English',

                          'Local',

                          'Head Office',

                          'Shared Services',

                          'Digital',

                          'Natal Witness Group',

                          'Old',

                          'Other',

                          'Paarl Coldset'

                          ),

                          If(GetFieldSelections(Business_Division)='English',

                                    Match(Business_Division,

                                    'Afrikaans',

                                    'Local',

                                    'Head Office',

                                    'Shared Services',

                                    'Digital',

                                    'Natal Witness Group',

                                    'Old',

                                    'Other',

                                    'Paarl Coldset'

                                    )

                          )

                )

      )

       

      //****************************//

       

      Problem: Business would like the sorting order of this Listbox to be consistent. When using a Match() or WildMatch() in the sort expression, the order of the dimension is correct, but when a user selects on a value the order is rearranged by default sort (i.e alph/num). The solution seemed simple to apply conditions on each selection and specify a sort order for each, however QlikView crashes each time a selection is made.

      Any advise or work-arounds will be much appreciated.

       

      Thanks in advance,

       

      Nathan Alard.

        • Re: QlikView crashing when using Sort Expression
          Jonathan Brough

          Do you have all that expression within the Sort expression. Never seen that much logic in there and suspect QlikView could have problems with this as it would need to process the logic for each record in the list box.

          See if you can apply this logic within the script. Perhaps you can load another table linked to the field. For instance, I wanted to show the last 12 months in a chart, so I linked another table to my Calendar called MonthSort. In this table I loaded in 12 fields called MonthSort1 to MonthSort12, and a link back to the calendar's Month field as follows:

           

          Month        MonthSort1      MonthSort2     MonthSort3      MonthSort4    etc.

          Jan            1                     12                  11                   10

          Feb            2                     1                    12                  11

          Mar            3                     2                    1                    12

          Apr            4                     3                     2                    1

          etc...

           

          I could then add MonthSort2 into the Sort expression when the months started with February, which would show January last (ass it's MonthSort value was 12).

           

          Your example might not be as complicated, with just three options.of Business Divisions.

          Jonathan

            • Re: QlikView crashing when using Sort Expression

              Thanks for the response Jonathan,

               

              I've loaded a "INLINE" table for the sorting, used a dual function(Business_Division, Business_Division_SortOrder) as the dimension(expresion) and used the Business_Division_SortOrder field in the sort expression as below .

               

              This has worked perfectly as needed.

               

              Many thanks!

               

              BusinessDivisionSort:

              LOAD * INLINE [

              Business_Division,            Business_Division_SortOrder

              'Afrikaans',                       1

              'English',                          2

              'Local',                             3

              'Head Office',                    4

              'Shared Services',             5

              'Digital',                           6

              'Natal Witness Group',      7

              'Old',                               8

              'Other',                            9

              'Paarl Coldset',                10

              ];

               

              Dual(Business_Division,Business_Division_SortOrder)