Hello,
I am attempting to pass cached data to a report. The data is cached in memory and retrieved. The report is designed using Report Designer and stored as .trdx. I create a dataobject that retrieves the data from the cache. I want to bind a table to a list of view models which match the described schema identically and contain all fields in the same order same spelling case sensitive. The header item is binding fine to reportitem.dataobject, but I cannot get the table to bind to the underlying List. it is saying that it contains LeadStatus that is not defined. However I have it defined in the XML
I load the report like so.
string
reportsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"Reports"
);
string
reportName = reportsPath + @
"\LeadsActivity.trdx"
;
System.Xml.XmlReaderSettings settings =
new
System.Xml.XmlReaderSettings();
settings.IgnoreWhitespace =
true
;
//read the .trdx file contents
using
(System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(reportName,settings))
{
Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer =
new
Telerik.Reporting.XmlSerialization.ReportXmlSerializer();
//deserialize the .trdx report XML contents
Telerik.Reporting.Report report = (Telerik.Reporting.Report) xmlSerializer.Deserialize(xmlReader);
var dataobjs =
new
LeadsActivityDataProvider(cacheKey);
report.DataSource = dataobjs;
string
mimType =
string
.Empty;
string
extension =
string
.Empty;
Encoding encoding =
null
;
// call Render() and retrieve raw array of bytes
// write the pdf file
byte
[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render(
"PDF"
, report,
null
,
out
mimType,
out
extension,
out
encoding);
// create a new file on disk and write the byte array to the file
FileStream fs =
new
FileStream(reportsPath + @
"\TestRpt.pdf"
, FileMode.Create);
fs.Write(buffer, 0, buffer.Length);
fs.Flush();
fs.Close();
}
return
reportsPath + @
"\TestRpt.pdf"
;
[DataObject]
public
class
LeadsActivityDataProvider
{
private
ReportDataCache cache =
new
ReportDataCache();
public
string
TestTitle {
get
;
set
; }
public
List<LeadActivityReportViewModel> TableData {
get
;
set
; }
public
LeadsActivityDataProvider(
string
cacheKey)
{
TestTitle =
"Test Title"
;
TableData = cache.Get<List<LeadActivityReportViewModel>>(cacheKey);
}
}
This element works
<
TextBox
Width
=
"7.9999213218689in"
Height
=
"0.499999980131786in"
Left
=
"0.0000394185371988in"
Top
=
"0in"
Value
=
"= ReportItem.DataObject.TestTitle"
Name
=
"Arial"
>
<
Style
TextAlign
=
"Center"
>
<
Font
Name
=
"Calibri"
Size
=
"12pt"
Bold
=
"False"
/>
</
Style
>
</
TextBox
>
However this table is giving me an Error
<
Table
Width
=
"7.97916757624932in"
Height
=
"1.21770811465888in"
Left
=
"0.0208326975504557in"
Top
=
"0in"
Name
=
"table2"
>
<
Body
>
<
Cells
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.203993031202274in"
Left
=
"3.3999605178833in"
Top
=
"0.100000063578288in"
Value
=
"=Fields.EventDate"
Format
=
"{0:d}"
Name
=
"textBox33"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.203993031202274in"
Left
=
"3.3999605178833in"
Top
=
"0.100000063578288in"
Value
=
"=Fields.FollowUpDate"
Format
=
"{0:d}"
Name
=
"textBox34"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=LeadStatus"
Name
=
"textBox37"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.CustomerName"
Name
=
"textBox38"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.SourceName"
Name
=
"textBox39"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"1"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.236979214728681in"
Left
=
"0in"
Top
=
"0in"
Value
=
"= Fields.QuoteNumber"
Name
=
"textBox40"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Event"
Name
=
"textBox1"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Follow Up"
Name
=
"textBox11"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Details"
Name
=
"textBox29"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"2"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.236979462490679in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox31"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"False"
Underline
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"4"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.216145749138395in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.EventCompletedBy"
Format
=
"{0}"
Name
=
"textBox42"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"4"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.216145749138395in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.SalesmanName"
Name
=
"textBox43"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"3"
ColumnIndex
=
"2"
RowSpan
=
"2"
ColumnSpan
=
"2"
>
<
ReportItem
>
<
TextBox
Width
=
"4.32291710512907in"
Height
=
"0.420138771518487in"
Left
=
"0in"
Top
=
"0in"
Value
=
"=Fields.EventDetails"
Name
=
"textBox30"
>
<
Style
BackgroundColor
=
"White"
/>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"0"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox8"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"1"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox9"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"2"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox10"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
<
TableCell
RowIndex
=
"0"
ColumnIndex
=
"3"
RowSpan
=
"1"
ColumnSpan
=
"1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.104166595363224in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox12"
StyleName
=
""
>
<
Style
BackgroundColor
=
"White"
>
<
Font
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
</
TableCell
>
</
Cells
>
<
Columns
>
<
Column
Width
=
"1.40624906538001in"
/>
<
Column
Width
=
"2.25000140574025in"
/>
<
Column
Width
=
"2.83333372958235in"
/>
<
Column
Width
=
"1.48958337554672in"
/>
</
Columns
>
<
Rows
>
<
Row
Height
=
"0.104166603885721in"
/>
<
Row
Height
=
"0.236979028603148in"
/>
<
Row
Height
=
"0.236979518525301in"
/>
<
Row
Height
=
"0.203992951132829in"
/>
<
Row
Height
=
"0.216145760447272in"
/>
</
Rows
>
</
Body
>
<
Corner
/>
<
Style
>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
/>
</
Style
>
<
RowGroups
>
<
TableGroup
Name
=
"leadStatus1"
>
<
ChildGroups
>
<
TableGroup
Name
=
"leadStatus"
>
<
ChildGroups
>
<
TableGroup
Name
=
"group5"
/>
<
TableGroup
Name
=
"group11"
/>
<
TableGroup
Name
=
"group18"
/>
<
TableGroup
Name
=
"detailTableGroup1"
>
<
ChildGroups
>
<
TableGroup
Name
=
"group19"
/>
<
TableGroup
Name
=
"group20"
/>
</
ChildGroups
>
<
Groupings
>
<
Grouping
/>
</
Groupings
>
</
TableGroup
>
</
ChildGroups
>
<
Groupings
>
<
Grouping
Expression
=
"=Fields.CustomerName"
/>
</
Groupings
>
<
Sortings
>
<
Sorting
Expression
=
"=Fields.CustomerName"
Direction
=
"Asc"
/>
</
Sortings
>
</
TableGroup
>
</
ChildGroups
>
<
Groupings
>
<
Grouping
Expression
=
"=Fields.LeadStatus"
/>
</
Groupings
>
<
Sortings
>
<
Sorting
Expression
=
"=Fields.LeadStatus"
Direction
=
"Asc"
/>
</
Sortings
>
</
TableGroup
>
</
RowGroups
>
<
ColumnGroups
>
<
TableGroup
Name
=
"tableGroup3"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Status"
Name
=
"textBox3"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group1"
>
<
ReportItem
>
<
TextBox
Width
=
"1.40624906538in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox2"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group14"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"tableGroup4"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Customer"
Name
=
"textBox6"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group2"
>
<
ReportItem
>
<
TextBox
Width
=
"2.25000140574025in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox4"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group15"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"tableGroup5"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Source of Lead"
Name
=
"textBox36"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group3"
>
<
ReportItem
>
<
TextBox
Width
=
"2.83333372958235in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox5"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group16"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
<
TableGroup
Name
=
"group"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.194444241854954in"
Left
=
"0in"
Top
=
"0in"
Value
=
"Quote #"
Name
=
"textBox41"
StyleName
=
""
>
<
Style
>
<
BorderStyle
Bottom
=
"Solid"
/>
<
BorderColor
Bottom
=
"Black"
/>
<
BorderWidth
Bottom
=
"1pt"
/>
<
Font
Name
=
"Calibri"
Size
=
"11pt"
Bold
=
"True"
/>
</
Style
>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group4"
>
<
ReportItem
>
<
TextBox
Width
=
"1.48958337554672in"
Height
=
"0.0250000016262168in"
Left
=
"0in"
Top
=
"0in"
Name
=
"textBox7"
StyleName
=
""
>
<
Style
BackgroundColor
=
"Black"
/>
</
TextBox
>
</
ReportItem
>
<
ChildGroups
>
<
TableGroup
Name
=
"group17"
/>
</
ChildGroups
>
</
TableGroup
>
</
ChildGroups
>
</
TableGroup
>
</
ColumnGroups
>
<
Bindings
>
<
Binding
Path
=
"DataSource"
Expression
=
"ReportItem.DataObject.TableData"
/>
</
Bindings
>
</
Table
>
Here is the view model
public
class
LeadActivityReportViewModel : ViewModelBaseActive {
public
string
CacheID {
get
;
set
;}
public
string
CustomerName {
get
;
set
;}
public
string
EventCompletedBy {
get
;
set
;}
public
DateTime EventDate {
get
;
set
;}
public
string
EventDetails {
get
;
set
;}
public
DateTime FollowUpDate {
get
;
set
;}
public
string
LeadStatus {
get
;
set
;}
public
string
QuoteNumber {
get
;
set
;}
public
int
Row {
get
;
set
;}
public
string
SalesmanName {
get
;
set
;}
public
string
SourceName {
get
;
set
;}
}
Hello!
How can save the Report for example the pdf file directly on the server?
I want to use the reportviewer.
Are there any suggestions?
A.Kleine
Hi,
ObjectDataSource business.Component not connection
Error !
No parameterless constructor defined for this object
I've got a number of text fields that I'm updating dynamically in the ItemDataBound function. What I'm finding is the updates are happening on the wrong page. Specifically, the results on the first page are actually the last page's results, and everything is shifted over 1.
As an example, the report has "RecordID" data bound, as a test, I am updating txtResult.Value in the "ItemDataBound" function to equal "RecordID" (txtTest.Value = section.DataObject["RecordID"]). The two text fields do not equal each other, and, as I said above, the results are shifted over by 1.
Hi,
I'm trying to sort a bar chart by using the sorting option in Telerik.Reporting.Graph ( see the attached files) with telerik Reporting Q1 2016 in Visual studio 2015.
Actually, i added a field and then i selected a 'Desc' sorting, but it's doesn't seem to be working , the bars chart order is unchanged.
(By the way i tried to sort programatically, like the exemple : http://docs.telerik.com/reporting/data-items-how-to-add-sorting-to-report-item, without success)
Has anyone found a way to pass the sorting parameters to a chart , or a solution that would work equally?
Any help or suggestion highly appreciated as I am stuck on something that should be simple to fix.
My application in summary has a person with properties (Name, Age, height, etc...). Also arrays of ushort or double that represent pressure waveforms. I wish to put this data onto a report for printing to PDFs.
I can successfully create a custom assembly and load it in the standalone ReportDesiger and it successfully fetches the data for the report for a single person. I can put the properties for the Name, Age, Height etc. on the report.
What I have not been able to do is present the array data in a form that can be consumed successfully by the report Graph.
Can someone please point me to an existing sample or suggestions on what classes I should copy the graph data into for it to then be usable in the Report Graph. I was expecting to use a scatter line graph as the Y axis doubles representing values in the range 0 to 300. The x axis is time. Some graphs are short duration (0.3 seconds), some are longer at around 10 seconds (2048 sample points).
A simplified model for testing purposes though might be as follows. You can see I have tried two different ways to represent the X & Y coordinates on the graph. In the final solution would only need one way, whatever that may be that makes report Graph work.
public class ReportModel
{
public string Fullname { get; set; }
public double[] X { get; set; }
public double[] Y { get; set; }
public List<Point> GraphPoints { get; set; }
public ReportModel()
{
Fullname = "John Doe";
X = new double[] { 1, 2, 3, 4, 5, 6, 7 };
Y = new double[] { 2, 4, 6, 8, 10, 12, 14 };
GraphPoints = new List<Point>();
for(int i = 0; i<X.Length; i++)
{
Point p = new Point();
p.X = X[i];
p.Y = Y[i]; }
}
}
public class Point
{
double x;
double y;
public double X
{
get
{
return x;
}
set
{
x = value;
}
}
public double Y
{
get
{
return y;
}
set
{
y = value;
}
}
}
Hi, Team
I export the report to PDF, the PDF support the bookmarks with Document Map Text,
but I export to MS word, I can not find bookmarks in navigation panel,
does support bookmarks in MS word navigation panel?
Thanks