SETRANGE with Datefilter

Hello, In the SETRANGE in the code of an ITEM report i would like to use the values of the datefilter. Does anybody know how i can solve this problem? For example: Item.SETRANGE(Datefilter,X); In this case is X the value the user enters in the field Datefilter when he tries to run the report. I’ve tried to make a variable of it (X := Item.GETFILTER(Datefilter):wink: but this one doesn’t work because of typeconversion text/date or date/text. Thank you for thoughts. Greetzz, Henry

Hi Henry GETFILTER returns a text variable which contains the filter set on the field this could be “…01/01/02|01/02/02…28/02/02|01/06/02…” or something like that using English dates (that’s the month and date reversed for the yanks). What you need to use are the functions GETRANGEMIN and GETRANGEMAX, which return the bottom and top of the range respectively. Be warned the variable has to be filtered by a range or else a run time error will occur. Paul Baxter

Thank you Paul, it works!

Hi, Henry. Hi Paul. An other solution might be to use SETFILTER, instead of SETRANGE. SETFILTER works with a text variable and allows any kind of filter, not just ranges. Anna

This one also works! Thanks!