Hi,
I have a report in which i have two prompts begin and end date. The report needs to be if the date range selected in the prompts is less than 3 months.
If it is greater than 3 months it should give user validation error saying check dates selected.
I tried creating a string variable and rendered that variable in my report weather to pass or fail, but it is not working.
This is the code i have written for creating string variable.
case
when
_months_between((string2timestamp (ParamValue('pBeginDate'))), (string2timestamp (ParamValue('pEndDate')))) = 3
then ('E')
else ('P')
end
It is relational model.
Thanks
I am not sure if _months_between will accept timestamp data types.
Try string2date instead of string2timestamp.
Also, you could get +3 or -3 returned depending on which date is greater.
i tried it but i am not getting any data in the report.
I need the begin and end date prompt to be within 3 months if its is greater than 3 months then user should be presented with error message.
I used render variable and selected P if condition is met and E if condition is not met. Data is displayed according to the block in which data is rendered.
I am attaching the screenshots.
Thanks
I think the first thing is to see exactly how your expressions are being evaluated, so put these values on the report - outside the conditional rendering, of course.
ParamValue('pBeginDate')
ParamValue('pEndDate')
string2timestamp (ParamValue('pBeginDate'))
string2timestamp (ParamValue('pEndDate'))
_months_between((string2timestamp (ParamValue('pBeginDate'))), (string2timestamp (ParamValue('pEndDate'))))
My guess is that something is not evaluating to what you would expect. This should help isolate that, or rule it out as an issue so other things can be looked into.
thanks..Its working