1. Daniel Vivier
  2. PowerBuilder
  3. Saturday, 11 May 2019 01:17 AM UTC

I did a filter on some names, some of which started with "A" or other capital letters, and some of which started with "a", where the filter expression was:

name > 'a'

It selected all of those names. If that was case sensitive, like I thought DW expression comparisons on strings were supposed to be, it would have excluded all of the ones that started with capital letters, since they are lower in the ASCII order (or Unicode code point order) than capital letters. 

Certainly if I use = in a comparison it is case sensitive.

Basically that filter seemed to be behaving as if I had used:

Upper(name) > Upper('a')

Is this expected behaviour? A bug? Something I don't understand about Unicode characters?

Daniel Vivier Accepted Answer Pending Moderation
  1. Tuesday, 21 May 2019 20:00 PM UTC
  2. PowerBuilder
  3. # 1

I'm experimenting some more and "dictionary order" is really weird.

If I use:

name < 'a' (or name < 'A')

I get only all names that start with anything other than a letter - whether its first letter is something before all of the letters in the ASCII table, between the capital and small letters, or after all of the small letters! (I tried "!" - ASCII 33, "^" - ASCII 94, between the the two types of letters, and "~" - ASCII 126.)

If I use:

name > 'a' (or name > 'A')

I get only things that start with any small or capital letters (same with either version).

Can anyone explain this is a relatively simple, coherent way that would be comprehensible to users of our software, who generally are not techies? We're trying to document the Filter capability we have built into the program.

Actually I think maybe I have it: In dictionary order, all characters other than upper or lower case letters are smaller than letters. And all letters are compared case-insensitively (as if both sides of the comparison were first converted to upper case).

Does that seem right?

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 13 May 2019 15:15 PM UTC
  2. PowerBuilder
  3. # 2

Hi Dan;

   FWIW: I would have coded it this way ....

Upper ( Left ( name , 1  )  ) <> "A"

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 14 May 2019 16:33 PM UTC
Hmmm ... found something in the PB Help ....



To perform comparisons in ASCII order, append "\s" to the format string. For example, the following expression shows only rows in which column 2 begins with a or b, because the ASCII values of uppercase letters are lower than the ASCII values of lowercase letters:



#2 >= 'a' and #2
  1. Helpful
  1. Daniel Vivier
  2. Friday, 17 May 2019 01:14 AM UTC
OK, so it's documented in the Help for SetFilter(). I think what Chris meant to give as the example (a variant of what is in that Help topic) is:



#2 >= 'a' \s
  1. Helpful
  1. Chris Pollach @Appeon
  2. Friday, 17 May 2019 14:31 PM UTC
Thanks Dan ... my posting of the example cut-off the " \s " in the CTRL+V ... Grrrrr
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.