3 Replies Latest reply: Jul 24, 2015 2:23 AM by Jonathan Dienst RSS

    Custom Sort

    Lucille Botha

      Hi all,


      I am trying to create a custom sort in my list box based on the below expression...


      I have used the following expression in the sort tab on the list box, but it does not seem to want to sort my field... see below..

       

      What am I doing wrong? It sorts the equations by starting from the 2-3; 6-10; 11-20; 4-5; 0-1;


       


      dual(DEM_TENURE, Index('0 to 12 to 34 to 5 to 1011 to 20Above 20',lower(DEM_TENURE)))


      =IF(DEM_TENURE <= 1, '0 to 1 ',
      IF(DEM_TENURE <= 3, '2 to 3 ',
      IF(DEM_TENURE <= 5, '4 to 5 ',
      IF(DEM_TENURE <= 10, '6 to 10 ',
      IF(DEM_TENURE <= 20, '11 to 20 ',
      'Above 20 ')))))

      Thank you

        • Re: Custom Sort
          Sushil Kumar

          Hi,

           

          Do you want to sort your dimension in order 2-3; 6-10; 11-20; 4-5; 0-1 ?

           

          which expression are you using as sort expression ?

           

          share a sample app if possible

          • Re: Custom Sort
            Prashant Baste

            Hi

             

            I think you need to write an expression in sort as -

             

            =IF(DEM_TENURE <= 1, 1,
            IF(DEM_TENURE <= 3, 2,
            IF(DEM_TENURE <= 5, 3,
            IF(DEM_TENURE <= 10, 4,
            IF(DEM_TENURE <= 20, 5, 6)))))


            here in this expression 1,2,3,4,5,6 are position satisfying conditions ...


            Hope this will be helpful for you.

             

            --

            Regards,

            Prashant P Baste

            • Re: Custom Sort
              Jonathan Dienst

              I assume that the DEM_TENURE expression is the one you want correctly sorted. I would integrate the Dual() into the expression itself:

               

              =IF(DEM_TENURE <= 1, Dual('0 to 1 ', 0),

              IF(DEM_TENURE <= 3, Dual('2 to 3 ', 2),

              IF(DEM_TENURE <= 5, Dual('4 to 5 ', 4),

              IF(DEM_TENURE <= 10, Dual('6 to 10 ', 6),

              IF(DEM_TENURE <= 20, Dual('11 to 20 ', 11),

              Dual('Above 20 ', 20))))))

               

              Now select the numerical option for the sort.