Based upon my example I've now added two more groups Yesterday and Yesterday (with error) and get a result in the lister that's not expected.
One of the files is sorted into group "Others" but should be inside group Yesterday (with error), because of it's creation date and the word "ERROR" in its filename.
Current coding is
if (is_dir) { return };
result = 11;
if ( DateDiff("d", Now(), value) == 0 ) { result = 1; }
elseif( DateDiff("d", Now(), value ) == -1 ) { result = 3; }
elseif( DateDiff("ww", Now(), value) == -1 ) { result = 5; }
elseif( DateDiff("m", Now(), value) == -1 ) { result = 7; }
elseif( DateDiff("yyyy", Now(), value) == -1 ) { result = 9; };
// increment the result when filename contains the word error
if (RegExS( name, "(.*)_ERROR(.*)" ) and result < 11 ) {
result += 1;
};
return(result);
Those static groups are defined:
The file in question was created on 2024-01-04 (yesterday). So basically the line
elseif( DateDiff("d", Now(), value ) == -1 ) { result = 3; }
should be hit, result is 3, incremented by 1 because of the "ERROR".
Neither group Yesterday nor Yesterday (with error) is selected.
For debugging purposes, I did output the variable result and I can confirm that the value is 4 for this specific file. The lister, however, puts that file into the group Other.
FWIW, I've set up a different folder, configured the folder format identical to the above one and get the correct group Yesterday (with error).
The only difference is that the folder with wrong grouping is a network drive, whereas the later one is a local drive.
When dropping those lines
// increment the result when filename contains the word error
if (RegExS( name, "(.*)_ERROR(.*)" ) and result < 11 ) {
result += 1;
};
the file in question is put into group Yesterday, which is correct.
So the question now is, why does the lister select the wrong group, when I increment the result by 1 or when choosing group 4?