Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cliff_clayman
Creator II
Creator II

How to sort list box with an expression

I have a list box that has some blanks in it, so I used an expression to remove them.  Upon doing so, the sort no longer works as it did previously.  I want to sort ascending.  I tried changing the sort from State - Auto Ascending to Expression - Ascending and then placing the expression in the box below, but it does not seem to work.  Here is the expression I am using:

=If(Len(Buyer)>0,Buyer)

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=If(Len(trim(PurgeChar(Buyer, Chr(48))))>0, Buyer)

View solution in original post

13 Replies
sunny_talwar

Have you tried sorting by Text in ascending?

cliff_clayman
Creator II
Creator II
Author

Yes, it does not change.  When I just choose to sort by Text Ascending, I still get the blank value on top even with the expression.

sunny_talwar

Have you removed checks from auto and expression, just with Text it isn't working?

cliff_clayman
Creator II
Creator II
Author

That is correct.  It does sort them Ascending, but the blank still shows up first.

sunny_talwar

What is the expression used for the list box? Isn't it this guy?

=If(Len(Buyer)>0,Buyer)

cliff_clayman
Creator II
Creator II
Author

Yes, that is the expression that I am using.

sunny_talwar

Why are you even seeing blanks then? You have me completely confused? Can you share sample or images?

m_woolf
Master II
Master II

I suspect that the "blank" buyer isn't really blank. Maybe it's a space or a number of spaces.

Try:

If(Len(trim(Buyer))>0,Buyer)

cliff_clayman
Creator II
Creator II
Author

I added a sample QVW file.