on 09-23-2008 2:49 PM
hello
how can i pass the variables date with parameterfield
thanks
Fields fields = new Fields();
ParameterField pfield2 = new ParameterField();
Values vals2 = new Values();
ParameterFieldDiscreteValue pfieldDV2 = new ParameterFieldDiscreteValue();
pfield2.setName("Date_EA");
pfieldDV2.setValue("2008-08-31");
//pfieldDV2.setDescription("");
vals2.add(pfieldDV2);
pfield2.setCurrentValues(vals2);
fields.add(pfield2);
And even if we put the date parameter in the way calendar(2008,10,01) in the java code ,the report data would be displayed in the way 01/10/2008.
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michel
The report always has a date parameter input of type yyyy-mm-dd .
However ,when the report is previewed (refreshed) ,the data (date value) will always be in the format 01/10/2008.
It works that way by design.
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moulery
Even though your report has the date format as 1/10/2008 ,you need to set it in this way through the code.
Calendar calendar = Calendar.getInstance();
calendar.set(2008,10,1);
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moulery
Which SDK are you using?
If you are using JRC SDK ,you would need to import
<%@page import="java.util.*"%>
for the Calendra class.
Hope this helps.
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it's ok inport java.util.*
I have write the code in my jsp
//DATE VALUE PARAMETER.
Calendar calendar = Calendar.getInstance();
calendar.set (2008,8,31);
Date dateParamVal = calendar.getTime();
pfield2.setName("Date_E");
pfieldDV2.setValue(dateParamVal);
//pfieldDV2.setDescription("");
vals2.add(pfieldDV2);
pfield2.setCurrentValues(vals2);
fields.add(pfield2);
but in my report i have 01/10/2008 ????
My report has a parameter input (date of type yyyy-mm-dd )
Thanks soni
Hi Moulery
Here is the snippet of code that will help you out.
try {
Object reportSource = session.getAttribute("reportSource");
if (reportSource == null)
{
ReportClientDocument oReportClientDocument = new ReportClientDocument();
oReportClientDocument.open("jrc_set_parameters_with_logon/jrc_set_parameters_with_logon.rpt", 0);
reportSource = oReportClientDocument.getReportSource();
session.setAttribute("reportSource", reportSource);
}
Fields oFields = new Fields();
//NUMBER VALUE PARAMETER.
Integer numberValue = new Integer("7");
//STRING VALUE PARAMETER.
String stringValue = "String parameter value.";
//BOOLEAN VALUE PARAMETER.
Boolean booleanValue = new Boolean("true");
//DATE VALUE PARAMETER.
Calendar calendar = Calendar.getInstance();
calendar.set(2004, 1, 17);
Date dateParamVal = calendar.getTime();
//DATE-TIME VALUE PARAMETER.
Calendar calendar2 = Calendar.getInstance();
calendar2.set(2002, 5, 12, 8, 23, 15);
Date dateTimeParamVal = calendar2.getTime();
//CURRENCY VALUE PARAMETER.
Double currParamVal = new Double(555.95);
//TIME VALUE PARAMETER.
Calendar calendar3 = Calendar.getInstance();
calendar3.set(2002, 5, 12, 13, 44, 59);
Date timeParamVal = calendar3.getTime();
//Set all of the parameter values using the utility function.
setDiscreteParameterValue(oFields, "NumberParam", "", numberValue);
setDiscreteParameterValue(oFields, "StringParam", "", stringValue);
setDiscreteParameterValue(oFields, "BooleanParam", "", booleanValue);
setDiscreteParameterValue(oFields, "DateParam", "", dateParamVal);
setDiscreteParameterValue(oFields, "DateTimeParam", "", dateTimeParamVal);
setDiscreteParameterValue(oFields, "CurrencyParam", "", currParamVal);
setDiscreteParameterValue(oFields, "TimeParam", "", timeParamVal);
//Push Fields collection into session so it can be retrieved by the viewer and set
//at view time.
session.setAttribute("parameterFields", oFields);
}
catch(ReportSDKException sdkEx) {
out.println(sdkEx);
}
Thanks
Soni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.