Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to get "-" in a date data field
Sandro
Hello,
I have a short question date data fields.
If a date parameter is not null I want to show the value of the parameter. This is no problem.
But if the parameter is null I want to show a “-“.
This works with any other parameter but not with my date parameters. I Use following expression in my data date field:
if (params["ending"].value != null)
params["ending"].value
else
"-"
The following error is shown:
Data (id = 435):
- Can not convert the value of - to java.sql.Date type.
Has anybody an idea how I can show a “-“ in my report if the parameter is null?
Greetings
Sandro
Find more posts tagged with
Comments
chimek-pl
1. Define report parameters as: <br />
p_year_end (string), p_month_end(string), p_day_end(string)<br />
<br />
2 Define field data (d_date_show) as String and write inside:<br />
/////// begin//////<br />
var v_val="";<br />
if(params["p_year_end"].value!= null && <br />
params["p_month_end"].value!=null &&<br />
params["p_day_end"].value!=null<br />
) { <br />
v_val+=params["p_year_end"].value;<br />
v_val+="-"; //separator<br />
if(params["p_month_end"].value.length<2) v_val+="0"; //month 1 --> 01<br />
v_val+=params["p_month_end"].value;<br />
v_val+="-"; //separator<br />
if(params["p_day_end"].value.length<2) v_val+="0" //day 1 --> 01<br />
v_val+=params["p_day_end"].value; <br />
}<br />
else<br />
v_val+="-";<br />
<br />
"DATE: " + v_val; //display value<br />
/////// end //////<br />
<br />
OUTPUT REPORT(for input: 2009 10 23):<br />
DATE: 2009-10-23<br />
OUTPUT REPORT(for input: null null null):<br />
DATE: -<br />
<br />
chimek_pl<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="Sandro"><p>Hello,<br />
<br />
I have a short question date data fields.<br />
<br />
If a date parameter is not null I want to show the value of the parameter. This is no problem.<br />
But if the parameter is null I want to show a “-“.<br />
<br />
This works with any other parameter but not with my date parameters. I Use following expression in my data date field:<br />
<br />
if (params["ending"].value != null)<br />
params["ending"].value<br />
else<br />
"-"<br />
<br />
The following error is shown:<br />
Data (id = 435): <br />
- Can not convert the value of - to java.sql.Date type. <br />
<br />
Has anybody an idea how I can show a “-“ in my report if the parameter is null?<br />
<br />
Greetings<br />
Sandro</p></blockquote>
chimek-pl
1. Define report parameters as:
p_date_end as date
2 Define field data (d_date_show) as String and write inside:
/////// begin//////
var v_val="";
if(params["p_date_end"].value!=null)
v_val=params["p_date_end"].value.toString();
else
v_val="-";
"DATE : " + v_val; //display value
////// end //////
OUTPUT REPORT(for input: 2009-10-23):
DATE: 2009-10-23
OUTPUT REPORT(for input: null null null):
DATE: -
chimek_pl