IF GETFILTER("Filter") <> '' THEN MatrixRec.SETFILTER(MatrixRec."No.",GETRANGEMIN("Filter"),GETRANGEMAX("Filter"));It seems that SETFILTER can function in the same way like SETRANGE, only it is probably not documented(?). Examples are in the Forms/Pages 9211, 9213, 9215.
MatrixRec.SETFILTER(MatrixRec."No.",GETFILTER("Filter"));My guess is, that in the first case '1..10' = '10..1' and in the second case not.
Comments
I use SETRANGE as much as possible, I never use SETFILTER if it is a single value or a range.
RIS Plus, LLC
Syntax:
Record.SETFILTER(Field, String, [Value],...)
You have to specify the filter as a string. The value parameters are optional in case you use the value substitution markers. So you could do this:
Record.SETFILTER("No.",'%1..%2','1','10');
The filter string would then end up being "1..10", so that is the same as this:
Record.SETFILTER("No.",'1..10');
Now you can also use SETRANGE for the same purpose. Syntax:
Record.SETRANGE(Field [,FromValue] [.ToValue])
and in your case you'd do this:
Record.SETRANGE("No.",'1','10');
And it would all come down to exactly the same thing.
RIS Plus, LLC
Please read carefully the first sentence in my first post
These bugs (if they are not a new undocumented functionality) are "all over" in the new standard. They are, for example, in the Forms/Pages 9211, 9213, 9215, 9217.
And I have tested it once again - the code works correctly only because of the "bug" in the function GETRANGEMIN. According to Help, it should return a runtime error, if the filter is '1|10', but in reality it returns exactly this string '1|10'. To make it more clear:
Filter := '1..5|10';
Rec.SETFILTER("No.", GETRANGEMIN("Filter"), GETRANGEMAX("Filter"));
results in
Rec.SETFILTER("No.", '1..5|10', '1..5|10');
Since the first parameter has no %1, the second parameter will be ignored.
There is no bug with functions GETRANGEMIN or GETRANGEMAX.
They work correct. The reason for misunderstanding is ' symbol.
Example.
prerequisite procedures
1. Open form 31
2. Add comand button with code in the trigger onPush: MESSAGE(GETRANGEMIN("Location Filter"));
3. Run this form.
test
1. Open FlowFilter window and specify location filter: Blue|Green
2. Close FlowFilter window and press the added button. You will get an error.
3. Open FlowFilter window and add ' to location filter: 'Blue|Green'
4. Close FlowFilter window and press the added button. The message will be "Blue|Green", not "Blue".
The same effect you saw in form 9211.
Thank you for the explanation, I didn't know those details about GETRANGEMIN/GETRANGEMAX.
It looks like you got your answer, so that's good
RIS Plus, LLC
I hilighted the part YuriM is refering to in his initial post. It looks realy strange to me also :-k . It must be either a :bug: or an undocumented feature, as YuriM says.
I have not checked it out yet, but according to my understanding, this code usually will reduce the filter range to be equal to the lower bound (GETRANGEMIN) and ignore the upper bound (unless the lower range looks like a filter string or does happen to contain replacement fields, where the upper bound was substituted :shock: :?
I belive, the code really should be (substituting the whole IF statement):