Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I've faced a problem trying to sort values in a listbox populated by the expression:
=if(EntryType = 'PR',
Project,
null()
)
The sort rule is:
State = "Auto Ascending"
Text = "A->Z"
Whenever any value from other fields is selected, the values of the listbox remain on their places although the possible values should be displayed first according to the sort rule.
The listbox with any field gets sorted perfectly well while it seems that it does not like expressions for sorting.
Are there any ideas how to solve the problem?
Thanks.
Valera
I am not sure but try this...
=if(EntryType = 'PR' and len(trim(Project)) >0, Project)
try this...
=if(EntryType = 'PR' and len(trim(Project)) >0, trim(Project))
Apply the same in Expression Sorting and say Ascending.. it should work
Hi Deepak,
Thanks for the suggestion. However, it does not change the situation. The sorting keeps not working.
Moreover, I can't continue excluding the empty strings from the listbox. In fact, I have a field Project and a field ProjectDescription. So, I display the project descriptions and there are some projects with empty descriptions. Still, I want to see them.
The Project table contains the fields Project, EntryType, ProjectDescription. So, by using the EntryType field I can populate the listbox only with the relevant project descriptions.
That's why my expression is:
=if(EntryType = 'PR', ProjectDesc)
As for the sort rule, it seems that I am forced to use both the State option, the Expression option and the Text option. If the Text option is excluded, the list remains simply unsorted. If the Expression option is excluded, the list remains sorted well, but the excluded items are simply marked as excluded and not moved to the end of the list.
This seems to be a kind of a QV bug or there is problem in the expression itself... Any further ideas?! 🙂
Thanks! 🙂
if you can attach the applictaion I can give it a try.........
The easiest approach would likely be to define the expression as a field in the script already and it will sort correctly in the listbox when you add it in your layout.
Hi Johannes,
I've tried to create an "artificial" field as an expression and could not find a way to do it. The only possibility was creating a group with an expression. When I use this group in the listbox the sorting seems to work perfectly.
However, the use of the group implies the display of a group symbol (either Cyclic or DrillDown) on the listbox which is confusing.
Are there other ways to create "artificial" fields?
Thanks.
Anyway, guys, find attached the application with the problem.
I guess there is some problem with the data because when I tried to load fewer records the sorting seemed to work fine... I'm definitely missing something. 🙂
Thanks for help! 🙂
P.S. When you open the application, you will see this list already:
HI Valera, I dont the reason but if you remove the State from sorting and Use Descending in Expression then it seems to be working fine...
But i dont know y its behving in this fashion....
Thanks for the suggestion, Deepak.
I removed the STATE from sorting, but then I have the old problem of excluded values inside the list (not in its end) back.
And, strangely, I see that the list itself is not sorted properly when EXPRESSION option is used. The list is sorted well only if its values are treated as TEXT. But the STATE option is ignored by QV in this case.
Thanks for suggestion.