[CLOSED] Create a second date range from a prompted one
Hi There
I'd like to get a Prior Year comparison. For this matter I would like the user to enter a current year date range. E.g.
ValutaDatum GE '&ValutaDatumvon.ValutaDatum von TTMMJJJJ.' AND ValutaDatum LE '&ValutaDatumbis.ValutaDatum bis TTMMJJJJ.'
This one is easy. However from this range I'd like to get the second range (Prior Year), which I don't how to make it work, as I cannot use the "defined" filter (Datefrom, Dateto) field in another filter.
Ideally I would do it like that: ValutaDatum GE dateadd('&ValutaDatumvon.ValutaDatum von TTMMJJJJ.','Y',-1) AND ValutaDatum LE dateadd('&ValutaDatumbis.ValutaDatum bis TTMMJJJJ.','Y',-1)
Looking for a elegant solution instead of asking the user for 4 dates (2 ranges).
thanks & regardsThis message has been edited. Last edited by: Tamra,
Webfocus 8.1 Windows 7 HTML, Excel, PDF
January 06, 2016, 02:57 PM
George Patton
Look up DATEADD. You can easily subtract a year from your VON and BIS values. Just use 'Y' as the second argument and -1 as the third.
I tried this, but however it wouldn't work..this is the filter set. In the report I am able to select the value range, however only the selected is displayed, but the selected through "DATEADD" is considered..
Can you see my mistake?
(ValutaDatum GE '&ValutaDatumvon.ValutaDatum von TTMMJJJJ.' AND ValutaDatum LE '&ValutaDatumbis.ValutaDatum bis TTMMJJJJ.' ) OR (ValutaDatum GE DATEADD(&ValutaDatumvon.ValutaDatum von TTMMJJJJ.,'Y',-1) AND ValutaDatum LE DATEADD(&ValutaDatumbis.ValutaDatum bis TTMMJJJJ.,'Y',-1))
thanks
Webfocus 8.1 Windows 7 HTML, Excel, PDF
January 21, 2016, 10:10 AM
Tamra
Hi ValEit,
To verify that the syntax is correct for the WHERE statement you can create a new defined field or compute and add the logic, run the report and see if the value is correct.
Searching the WebFOCUS or InfoAssist forums for DATEADD will provide a few ideas on coding this.