Project

General

Profile

Bug #8260

treelist sorting column with null and empty string values does not produce correct result

Added by Șerban Bursuc 3 months ago. Updated 25 days ago.

Status:
Feedback
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
case_num:

History

#2 Updated by Șerban Bursuc 3 months ago

  • File naam_desc.png added
  • File naam_asc.png added
  • File ext_asc.png added

Using the TreeList testcase:

We add nodes with the following cell values

on choose of btnCreateNode do:
do i = 1 to 5:
...
        if i MODULO 3 = 0 then do:
         {&tree}:SetCellStringValue(inewNode, 0, "null vals").
        end.
        if i modulo 3 = 1 then do:
          {&tree}:SetCellStringValue(inewNode, 0, "empty strings").
          {&tree}:SetCellStringValue(inewNode, 1, "").
          {&tree}:SetCellStringValue(inewNode, 2, "").
          {&tree}:SetCellStringValue(inewNode, 3, "").
          {&tree}:SetCellStringValue(inewNode, 4, "").
          {&tree}:SetCellStringValue(inewNode, 5, "").
          {&tree}:SetCellStringValue(inewNode, 6, "").
          {&tree}:SetCellStringValue(inewNode, 7, "").
         end.
         if i modulo 3 = 2 then do:
          {&tree}:SetCellStringValue(inewNode, 0, "ext not null").
          {&tree}:SetCellStringValue(inewNode, 3, random(100,200)).
         end.

nodes fieldlist, index: key1 and index: keyid are not spawned by this trigger.

We add these nodes to the root node.

From #8093 sorting with nulls has the rule that in natural order nulls are put first and when in reverse put last. This matches 4GL behavior when all column values are not null or empty string. When this isn't the case, there is a mismatch.

Please see the pictures in #8093-39.

#3 Updated by Greg Shah 3 months ago

  • Subject changed from fdyntree: sorting column with null and empty string values does not produce correct result to treelist sorting column with null and empty string values does not produce correct result

#4 Updated by Șerban Bursuc 3 months ago

  • File deleted (naam_desc.png)

#5 Updated by Șerban Bursuc 3 months ago

  • File deleted (naam_asc.png)

#6 Updated by Șerban Bursuc 3 months ago

  • File deleted (ext_asc.png)

#7 Updated by Vladimir Tsichevski 26 days ago

Șerban Bursuc wrote:

Using the TreeList testcase:

We add nodes with the following cell values

[...]

nodes fieldlist, index: key1 and index: keyid are not spawned by this trigger.

We add these nodes to the root node.

From #8093 sorting with nulls has the rule that in natural order nulls are put first and when in reverse put last. This matches 4GL behavior when all column values are not null or empty string. When this isn't the case, there is a mismatch.

Please see the pictures in #8093-39.

Where can I see the complete code example?

#8 Updated by Vladimir Tsichevski 25 days ago

  • Status changed from New to Feedback
  • File 5084.p added

I reproduced the situation using 5084.p, and I found no difference between OE and FWD. What is wrong with FWD?

#9 Updated by Șerban Bursuc 25 days ago

Vladimir Tsichevski wrote:

I reproduced the situation using 5084.p, and I found no difference between OE and FWD. What is wrong with FWD?

I downloaded the file. Just a note, it contains customer data so you should probably remove the file.

I also can't run the test. The problem is here:

OCXFile = SEARCH( "C:\Users\fwd\Documents\tree.wrx":U ).
chCtrlFrame = CtrlFrame:COMPONENT-HANDLE.
chCtrlFrame:LoadControls(OCXFile, "CtrlFrame":U).

I get the error that I couldn't load the control frame.

I tried using a wrx from another similar testcase but it still gives me an error when loading the controls. I changed the path accordingly but it still doesn't work for some reason. Maybe I'm missing something else.

As for what's different, it's a bit more apparent from the screenshots in #8039-39, but I can see that you also have a similar test scenario as there and didn't get any issue. I think we need some common ground here - either you run the test from #8039-39 or I make 5084.p work to properly test.

#10 Updated by Vladimir Tsichevski 25 days ago

  • File deleted (5084.p)

#11 Updated by Vladimir Tsichevski 25 days ago

Șerban Bursuc wrote:

As for what's different, it's a bit more apparent from the screenshots in #8039-39

There is no such note at #8039 :-(

#12 Updated by Șerban Bursuc 25 days ago

Vladimir Tsichevski wrote:

Șerban Bursuc wrote:

As for what's different, it's a bit more apparent from the screenshots in #8039-39

There is no such note at #8039 :-(

Sorry, I meant #8093-39.

#13 Updated by Vladimir Tsichevski 25 days ago

As I see this:

  1. If a string tree column has non-empty values, empty string values and unknown values, when expected ascending order is:
    1. unknowns
    2. empties
    3. non-empties

    So all nulls are less than empties.
    Issue 1: in FWD empties are more than unknowns.

  1. If a string tree column consist of empty strings and unknowns only, when reordering does not happen (effectively unknowns and empties are all equals each other.
    Issue 2: in FWD reordering happens in this situation.

Correct?

#14 Updated by Șerban Bursuc 25 days ago

  • Assignee set to Eric Faulhaber
  • vendor_id deleted (GCD)

Vladimir Tsichevski wrote:

As I see this:

  1. If a string tree column has non-empty values, empty string values and unknown values, when expected ascending order is:
  1. unknowns
  2. empties
  3. non-empties

So all nulls are less than empties.
Issue 1: in FWD empties are more than unknowns.

  1. If a string tree column consist of empty strings and unknowns only, when reordering does not happen (effectively unknowns and empties are all equals each other.
    Issue 2: in FWD reordering happens in this situation.

Correct?

All correct.

For issue 1, I was responsible for adding this behavior. The problem was we weren't accounting for null column values, so we simply needed a null comparator, but apparently Comparator.nullsFirst and Comparator.nullsLast doesn't have the exact same precedence as OE, so this problem occured.

As for issue 2, I don't understand whether OE just refuses to sort the column, or it doesn't do anything because empty string and null are the same and it always sorts the same.

#15 Updated by Șerban Bursuc 25 days ago

  • Assignee changed from Eric Faulhaber to Șerban Bursuc
  • vendor_id set to GCD

Sorry for the random assignment, it was not intentional.

#16 Updated by Vladimir Tsichevski 25 days ago

  • vendor_id deleted (GCD)
  • Assignee changed from Șerban Bursuc to Eric Faulhaber

Șerban Bursuc wrote:

As for issue 2, I don't understand whether OE just refuses to sort the column, or it doesn't do anything because empty string and null are the same and it always sorts the same.

I was not able to find the answer quickly either. I think, we may ask customers if they find this issue significant.

Also available in: Atom PDF