4 Replies Latest reply on Jan 27, 2013 12:09 PM by Hjava

    space and sorting ?

      I have the following string &mystring=test8@gmail.com; test13@gmail.com; test5@gmail.com; test8@gmail.com; test7@gmail.com; test8@gmail.com;
      Local array of string &array_string = Split(&mystring, ";");

      it become test5@gmail.com-> test7@gmail.com-> test8@gmail.com->test13@gmail.com->test8@gmail.com->test8@gmail.com
      why not test5@gmail.com-> test7@gmail.com-> test8@gmail.com->test8@gmail.com->test8@gmail.com->test13@gmail.com
        • 1. Re: space and sorting ?
          Because your sort order is probably set to binary (PeopleTools options page). From the PeopleBooks:
          The type of sort done by this function, that is, whether it is a linguistic or binary sort, is determined by the Sort Order Option on the PeopleTools Options page.
          • 2. Re: space and sorting ?
            on PeopleTools > Personalization > Personalization Options can see the sorting setting
            • 3. Re: space and sorting ?
              you are sorting an array of strings. Therefore, the sort will be done based on the ASCII character code. Alpha and numeric characters are handled in the same way. The ascii character code for 1 = 49 and for 8 = 56.

              So, in your example test13@gmail.com->test8@gmail.com becuase the number 49 naturally comes before 56. in sorting strings no differentiation is made between alpha and numeric characters.

              imagine you were sorting the following strings. What would you want the sort behaviour to be? Logically an ascii based sort would produce a sort order that may not match what a human might illogically want.


              To my knowledge... there is no way to control the behaviour of this kind of sorting in PeopleTools.

              There may be a way to break out of PeopleCode and do a sort in Java. http://stackoverflow.com/questions/104599/sort-on-a-string-that-may-contain-a-number

              Good luck
              • 4. Re: space and sorting ?
                Thanks for the reply,
                I just may sure there is not space between my sorting string to deal with the problem. my questions is why??
                in ASCII space is 32 letter is 65 to 90 and 97 to 122, how come the space can cause the sorting problem???