Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
cburlon7 Absent Member.
Absent Member.
1701 views

Combo Box sorting

Jump to solution

We've recently run into a problem with combo boxes and mixed case data that I am looking for some clarification on. 

Regardless of how we have the "Unsorted" property set (TRUE or FALSE), modifying the combo box for a given value always goes to the first matching value independent of the items case. 

We have a scenario in a live system where the following 2 items are in a combo box. "aa" and "AA". When modifying the combo box with either "aa" or "AA", the end result is the item that is shown as being selected, is whichever one is sorted in the combo box first.

I've written a small Acubench program for the following example and attached to this post.

Example: I have 2 combo boxes with the following values loaded in this exact order. 

"A1 3", "B1 2", "C1 1", "a1 4", "b1 1", "c1 2". 

The first has the property of Unsorted (false), the second Unsorted (true).

Here is the output based on the unsorted flag

Unsorted (false) - (So in effect sorted) Unsorted (true) - (So in effect NOT sorted)

"A1 3"

"a1 4"

"b1 1"

"B1 2"

"C1 1"

"c1 2"

"A1 3"

"B1 2"

"C1 1"

"a1 4"

"b1 1"

"c1 2"

******

Unsorted (false) sorts the items A-Z as if there were no case. So ignoring case, "A1 3" is less than "a1 4" so comes first. However even though it was loaded later "b1 1" is less than "B1 2" so the lower case appears first. 

If I modify the combo box with the value "a" or "A" it selects "A1 3". However "b" or "B" selects "b1 1". 

******

Unsorted (true) sorts the list exactly in the order the records were added. 

If i modify the combo box with the value "a" or "A" it still selects "A1 3". However "b" or "B" now selects "B1 2". 

******

In my opinion the behavior of both cases is "incorrect", but even if I'm not understanding something and they are correct, the behavior at least seems to be at odds. 

To me both should return/select the value that matches the case you used to modify, but even if they both don't I would think one of them would have. 

0 Likes
1 Solution

Accepted Solutions
Micro Focus Contributor
Micro Focus Contributor

RE: Combo Box sorting

Jump to solution

I think this is correct behavior. The documentation for combo-boxes with the drop-list style points to how list-box values are handled. And that doc states:

When VALUE is set, the list is searched for an exact, case-sensitive match with the specified value. If the value is found, it is selected. If an exact match is not found, the list is searched for an exact match regardless of case. If a match is still not found, the list is searched again, this time for the first string that contains the passed VALUE as a leading substring, regardless of case. For example, if your list contains:

Capital Building

Capital-inc, unit 2

Capital-Inc

and VALUE is set to Capital-Inc, the third item is selected. If VALUE is set to CAP, the first item is selected.

Note that this is independent of sorting. In your case, you have A1 3 and a1 4. When setting the value to a or A, the item selected (by the above rules) will be A1 3, since there is not an exact match. Similarly with the unsorted combobox.

I hope this helps

View solution in original post

0 Likes
2 Replies
Micro Focus Contributor
Micro Focus Contributor

RE: Combo Box sorting

Jump to solution

I think this is correct behavior. The documentation for combo-boxes with the drop-list style points to how list-box values are handled. And that doc states:

When VALUE is set, the list is searched for an exact, case-sensitive match with the specified value. If the value is found, it is selected. If an exact match is not found, the list is searched for an exact match regardless of case. If a match is still not found, the list is searched again, this time for the first string that contains the passed VALUE as a leading substring, regardless of case. For example, if your list contains:

Capital Building

Capital-inc, unit 2

Capital-Inc

and VALUE is set to Capital-Inc, the third item is selected. If VALUE is set to CAP, the first item is selected.

Note that this is independent of sorting. In your case, you have A1 3 and a1 4. When setting the value to a or A, the item selected (by the above rules) will be A1 3, since there is not an exact match. Similarly with the unsorted combobox.

I hope this helps

View solution in original post

0 Likes
cburlon7 Absent Member.
Absent Member.

RE: Combo Box sorting

Jump to solution

Thank you. I see that now under the List Box common properties documentation.

In regards to sorting, it seems that the combo box property handles the same as the list box as well and that just ignores case implicitly as opposed to spelling that out in the documentation.

End result it looks like in cases where it matters, we'll just set the exact value and not part of it.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.