Hi,
I use a custom IReportResolver in combination with the ReportConnectionStringManager and it works well. However my next requirement is to support subreports where the ReportSource property is set to a parameter, e.g. = Parameters.invoiceReport.Value. This is a problem when attempting to update the connection string on the subreport, the name is given as the expression, not the evaluation of the expression. It seems that I can evaluate the expression myself with a bit of work and checking the Http context request referrerUrl property, but looks a bit fragile.
If you look at the code for ReportConnectionStringManager you can see that it assumes here:
using
(var xmlReader = System.Xml.XmlReader.Create(uriReportSource.Uri, settings))
that the Uri is already evaluated, but it's not, it is the string "= Parameters.invoiceReport.Value". Do you have any suggestions other than evaluating the expression myself?
Thanks,
Hi,
Been trying to set the figure out how to properly set the data of my sub report, thru searching on the threads I managed to come up with this code but testing it still does not show the data of my subreport. For the main report its seems fine, it there anything I miss out?
Below is the code
private
void
Form1_Load(
object
sender, EventArgs e)
{
var service =
new
TelerikReportDatasource.Service.ReportServiceEncounter();
var reportParameter =
new
TelerikReportDatasource.ParameterModel.ViewReportEncounter1ParameterModel
{
ProviderId = 1,
PatientId = 0,
PatientCaseId = 0,
ApptDate = Convert.ToDateTime(
"9/28/2015"
),
EncounterDate = Convert.ToDateTime(
"9/28/2015"
),
IgnoreMainSettings =
false
,
IsTimeCheck =
false
,
IsPrintedCheck =
true
,
IsSortByAlpha =
false
,
ConnectionString =
"some connection string"
,
IsMandatoryNPExam =
false
,
OnePerAppt =
false
,
ShowCTytd =
true
,
PastVisit =
true
,
FutureAppt =
true
,
NumberFutureAppts = 0,
SetCPTList =
true
,
DiagCount = 12,
SetEncMemo =
true
,
SetEncSpec =
true
,
SystemTimeZone = 2,
UserTimeZone = 2
};
var telerikReportSource = service.GetReportData(reportParameter);
var reportObjectDatasource =
new
ObjectDataSource();
reportObjectDatasource.DataSource = telerikReportSource.Encounter1Data;
reportObjectDatasource.DataMember =
"GetEncounter1"
;
var uriReportSource =
new
UriReportSource();
uriReportSource.Uri =
"rptEncounter.trdx"
;
var report = DeserializeReport(uriReportSource);
report.DataSource = reportObjectDatasource;
//Set the subreport datasource
var subReportPatDiag = (SubReport)report.Items.Find(
"PatDiag"
,
true
).FirstOrDefault();
var subReportPatDiagReportsource = (UriReportSource)subReportPatDiag.ReportSource;
subReportPatDiagReportsource.Parameters.Add(
"ApptID"
, telerikReportSource.Encounter1Data.FirstOrDefault().AppointID);
var reportPatDiag = DeserializeReport(subReportPatDiagReportsource);
var reportPatDiagSource = (ObjectDataSource)reportPatDiag.DataSource;
reportPatDiagSource.DataSource = telerikReportSource.Encounter4Data;
reportPatDiagSource.DataMember =
"GetEncounter4"
;
reportPatDiag.DataSource = reportPatDiagSource;
var reportSource =
new
InstanceReportSource();
reportSource.ReportDocument = report;
reportViewer1.ReportSource = reportSource;
reportViewer1.RefreshReport();
}
/// <summary>
/// Deserialize the TRDX report file from uri report to be able to use it as a report
/// </summary>
/// <param name="uriReportSource"></param>
/// <returns></returns>
Report DeserializeReport(UriReportSource uriReportSource)
{
var settings =
new
System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace =
true
;
using
(var xmlReader = System.Xml.XmlReader.Create(uriReportSource.Uri, settings))
{
var xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
var report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
return
report;
}
}
Help is greatly appreciated
Hi,
Using the HTML report viewer I am generating the html/javascript from an aspx class and am adding date parameters so that the resulting Javascript looks like this:
$(
"#reportViewer1"
)
.telerik_ReportViewer({
// The URL of the service which will serve reports.
// The URL corresponds to the name of the controller class (ReportsController).
// For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
serviceUrl:
"api/reports/"
,
// The URL for the report viewer template. The template can be edited -
// new functionalities can be added and unneeded ones can be removed.
// For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
templateUrl:
'ReportViewer/templates/telerikReportViewerTemplate-9.2.15.930.html'
,
//ReportSource - report description
reportSource: {
// The report can be set to a report file name (trdx report definition)
// or CLR type name (report class definition).
report:
"ReasonsForDemurrageBasic"
,
// Parameters name value dictionary
parameters: {
restrictClientAccountCompanyKey : 1,portKey : 2,dateFormat :
"dd/MM/yy"
,startDate :
new
Date(
"2015/01/01"
),endDate :
new
Date(
"2015/11/01"
),suppressTitles :
false
}
},
So you can see that I am setting up to date parameters without times. I want these dates to be passed back when executing the report as is, I don't want any timezone conversion. When the report is run, using Fiddler I can see that the request is:
{
"report"
:
"ReasonsForDemurrageBasic"
,
"parameterValues"
:{
"restrictClientAccountCompanyKey"
:1,
"portKey"
:2,
"dateFormat"
:
"dd/MM/yy"
,
"startDate"
:
"2015-01-01T05:00:00.000Z"
,
"endDate"
:
"2015-11-01T05:00:00.000Z"
,
"suppressTitles"
:
false
}}
You can see that it has assumed that I want the dates converted (with an assumption of a time if 0:0:0 in my local timezone) into UTC. I realise that the trend now is for JSON to write dates in this format with the timezone, but is there a way without hacking telerikReportViewer-9.2.15.930.min.js to stop it adjusting the time? "startDate":"2015-01-01T00:00:00.000Z" would be ok for example in this case.
Thanks,
Scott
hi, i am unable to find Telerik Reporting Q2 2013 ... i have search all over in my acount >product and subscription >trials> reporting > download > all production versions. there are only two production versions. 9.2 and 9.1 i want Telerik reporting q2 2013 7.1 version. please help or give me link or ftp so where i can download it directly..
thanks a lot.
Hi
I am using Telerik Reporting 2013 in a WPF application.
I have ReportViewer inside on of my windows.
I would like to change the font size of the zoom control, since the font is to big the report generate another line to fit the control size.
Files are attached.
Thanks
Ron
I'm changing my report parameter through NeedDataSource or ItemDataBinding events but these events are firing only once? Why? It fires only when the report is generated the first time.
The event looks like
private void rptKomplet_NeedDataSource(object sender, EventArgs e)
{
Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
this.sqlDataSource1.Parameters["@some_param"].Value = <here comes param from controller>;
report.DataSource = sqlDataSource1;
}​