I'm in this situation: I have a subreport that has a graph that is filled with a set of values that are generated by an application. The application is configured to consume data from a database according to a period of time, and in case that a certain period doesn't have any values (for example, for a specific day or for a specific hour), it will generate a empty one, with the date only. The thing is that I have a column in one of this files that has a value that I use in the title of the subreport, and when the first date is one of this dummy dates, instead of taking the value I need from the column, what I get is the dummy value of that dummy first row.
So my question: Is there anyway to look in the dataset for a specific value? The dummy value is the same always (0), and I was thinking about setting a variable with a expression that would bring the value that I need (something like "if <field> doesn't equals to 0, then print the name"
1 Answer:
Use can use the folloiwng ternary operator as text field expression in the title section of your sub report:
$F{date_column}==0?"print default name":$F{value_column}