Can I just clarify the two ways of restricting the data shown in your report
-
Using a FILTER in the report based on a UserResponse value as jobjoris suggested
-
Using a CONDITION in the query which restricts the data returned from the database, as I suggested.
First you need to be clear which of these you are trying to achieve. Option 1 returns more rows then you hide some in a particular table, but you may want to show those hidden rows in a different table or perform a calculation based on them. Option 2 removes the rows you want to filter so they will not be available in the report, it means the report is smaller and the query may run quicker, but the filtered rows are not available for any other purpose like calculations.
OK, now assuming you want to go with option 2. Firstly I would suggest NOT to put it in the Where clause of the object, because you will always get this prompt when using that object, and it may conflict with other joins in your schema. It is far better to create a Condition object (yellow filter icon) which the user can then include in the report if they want that prompt restriction.
So in your trial of this method (albeit using the Where clause) you got ‘inconsistent datatypes’ message. I have just tested and the bit it does not like is
Prompt('Enter Date','D','Orphans\Header Dt',MONO,FREE) - 14
which is odd - I assumed it would work. Anyway I think the following (or something similar) can be made to work:
ORPHANS.HEADER_DT BETWEEN next_day(@Prompt('Enter Date','D','Orphans\Header Dt',MONO,FREE), 'FRIDAY')-14 AND next_day(@Prompt('Enter Date','D','Orphans\Header DT',MONO,FREE), 'FRIDAY')-7
So you end up finding the next friday from the users date and subtracting 14 and 7 days from this.
Let us know how you get on.
beckster
(BOB member since 2003-02-18)