This is a migrated thread and some comments may be shown as answers.

BETWEEN parameter

2 Answers 175 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Shoji Kaburagi
Top achievements
Rank 1
Shoji Kaburagi asked on 13 Feb 2014, 02:22 PM
Hello,

We are developing a web service that loads TRDX files that users created into XmlReportSource and renders PDF files and send back to web clients using RenderReport of a ReportProcessor object. In TRDX files, our users want to set two parameters in SQL to create a SQL statement that contains BETWEEN with a begin date and a end date and use just one parameter to pass in, separated by commas.

The SQL statement is something like:

SELECT * FROM APPLICANT
WHERE DATE_CREATED BETWEEN @BeginDate AND @EndDate

Since our users have accustomed to pass just one parameter to accomplish this, they are unwilling to create two report parameters: one for begin date and one for end date. They want to create just ONE report parameter to basically parse the report parameter value into two SQL parameter values.

I have created a report parameter type string that receives the begin date and the end date separated by a comma ex. 1/1/2013,12/31/2013.

In the data source side, I would like to do something like:
Parameters:
Name: @BeginDate
Type: DateTime
Value:=CDate(Split(",",  Parameters.ReportDate.Value[0]))

Name: @EndDate
Type: DateTime
Value:=CDate(Split(",",  Parameters.ReportDate.Value[1]))

Of course this give me errors at [ characters.

Is there anyway to define the parameter?

Thanks

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 18 Feb 2014, 01:29 PM
Hello Shoji,

You can create a User Function and pass to it the string containing the begin and end dates together with a control parameter. Split the string inside the user function and return the begin or end date depending on the passed control parameter. Then you can use the user function inside an expression.

Regards,
Nasko
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

0
Shoji Kaburagi
Top achievements
Rank 1
answered on 18 Feb 2014, 02:58 PM
Got it!

Thanks!
Tags
Report Designer (standalone)
Asked by
Shoji Kaburagi
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Shoji Kaburagi
Top achievements
Rank 1
Share this question
or