I am currently trying to apply a style that basicaly changes to colour of the measures(detail) text field in a crosstab to indicate the date that was chosen via a parameter that the user must imput at the start of the report. Here are the steps I followed:
I created a parameter $P{Date} as java.sql.timestamp and checked "is for prompting"
Created the same parameter $P{Date} in my Dataset query with same info as previous parameter (this dataset is gonna be used to fill the crosstab)
Create the same parameter $P{Date} in my crosstab item, also same info as before
On my crosstab properties in "Dataset" I added my parameter with same name "Date" and expression $P{Date} and left parameters Map as blank
So far the report runs fine and the data parameter is working for my crosstab, filtering the data by the date chosen for the parameter.
Created my conditional style (Style1) with the following expression:
AND(MONTH(${crosstab_month}).equals(MONTH($P{Date})),
YEAR(${crosstab_month}).equals(YEAR($P{Date})),
DAY(${crosstab_month}).equals(01))
${crosstab_month} is the column group that displays the Date (contains the first day of each month, and is also a timestamp).
Now when I run the report I can't seem to get this to work, I put the markup on all fields as "styled" and in the "Style and Print Details" as Style1.
Am I forgetting something? I don't understand why this is not working, because if I change the $P{Date} with NOW() in the style expression it works... is the $P{Date} value somehow not evaluating correctly as a date/timestamp?
So i made a workaround to fix this issue, and that was the alter the query to get a value of the input parameter $P{Date}, and insert a new column in my crosstab (with w=0 and h=0).
After that i altered the style condition to;
AND(MONTH(${crosstab_month}).equals(MONTH($V{ReportDate})),
YEAR(${crosstab_month}).equals(YEAR($V{ReportDate})),
DAY(${crosstab_month}).equals(01))
$V{ReportDate} is the name of the new column group on the crosstab.
Hope this helps! :) Thank you!