Hello guys, i'm having a big problem and this time i don't think it's possible to solve with telerik reporting.
I've a big accounting reporting with a lot of data, so eventually a lot of pages.
In this report i've groups, and i'm using the ColumnHeadearsPrintOnEveryPage = true. So far is OK. But the problem is, when the group break automatically i need to show one value of the last row of the page before in the Header.
Is it possible?
Request URL:
http://localhost:5011/api/reports/clients/a424ed34405/parameters
Response error:
{
"message": "An error has occurred.",
"exceptionMessage": "Invalid report type",
"exceptionType": "System.ArgumentException",
"stackTrace": " at Telerik.Reporting.Processing.TypeReportDocumentResolver.Resolve(IProcessingContext context, TypeReportSource rs)\n
at Telerik.Reporting.Processing.ReportDocumentResolver`1.Telerik.Reporting.Processing.IReportDocumentResolver.Resolve(IProcessingContext context, ReportSource rs)\n
at Telerik.Reporting.Processing.ReportDocumentResolver.<>c__DisplayClass0_0.<Resolve>b__0(IReportDocumentResolver r)\n
at Telerik.Reporting.Processing.ReportDocumentResolver.Bind[T](IProcessingContext context, ReportSource source, Func`2 func)\n
at Telerik.Reporting.Processing.ReportDocumentResolver.Resolve(IProcessingContext context, ReportSource source)\n
at Telerik.Reporting.Processing.ResolvedReportDocument.ResolveReportsRecursively(ReportSource rs, IProcessingContext context, IDictionary`2 parentRsParameters, Boolean parentShouldDispose, List`1 result, IReportDocument& definition, ResolvedReport& tocReport, ReportBookTocPosition& tocReportPosition)\n
at Telerik.Reporting.Processing.ResolvedReportDocument.Create(ReportSource rs, IProcessingContext context)\n
at Telerik.Reporting.Processing.DocumentParametersManager`1..ctor(ReportSource definition, IProcessingContext processingContext, IParameterValueParser parameterValueParser)\n
at Telerik.Reporting.Processing.DocumentParametersManager..ctor(ReportSource rs, IProcessingContext processingContext, IParameterValueParser parameterValueParser)\n
at Telerik.Reporting.Services.Engine.ReportEngine.GetParameters(String clientID, String report, Dictionary`2 parameterValues)\n
at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource)\n
at lambda_method(Closure , Object , Object[] )\n
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\n--- End of stack trace from previous location where exception was thrown ---\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location where exception was thrown ---\n
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
}
I'm dynamically setting the value on a PictureBox to a api controller that resizes the image from storage and returns the bytes.
ex: https://localhost:44300/company-logos/4?width=96
Getting this error:
An error has occurred while processing PictureBox 'Logo':
Invalid image data.
------------- InnerException -------------
Too many automatic redirections were attempted.
This was working fine up until a couple weeks ago. Not sure what changed to be honest.
If I access the route directly, the controller works as expected (returns the resized image). When setting it in the report, the controller never gets called.
If I set the value to an external source, it's working. Of course the image isn't resized though.
ex: https://somedomain.blob.core.windows.net/logos/00000004/635939217942995665_FullSizeRender.jpeg
Hi,
I'm using below code to generate report on run time:
using
(ReportBook reportBook =
new
ReportBook())
{
foreach
(Object input
in
inputValues)
{
InstanceReportSource reportSource =
new
InstanceReportSource
{
ReportDocument =
new
MyReport
{
DataSource =
new
JsonDataSource
{
Name =
"jsonDataSource1"
,
Source = genJsonDataSource(input)
// get json string from input object
}
}
};
reportBook.ReportSources.Add(reportSource);
}
ReportProcessor reportProcessor =
new
ReportProcessor();
InstanceReportSource instanceReportSource =
new
InstanceReportSource
{
ReportDocument = reportBook
};
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource,
new
System.Collections.Hashtable());
// save report file from result
......
}
MyReport is a c# report class created by visual studio designer. It is designed with a json datasource named "jsonDataSource1" with some sample data in it. The report is generated as PDF but error is shown as in attached screenshot. I followed the instructions in https://docs.telerik.com/reporting/knowledge-base/missing-assembly-reference-when-using-jsondatasource by referencing Telerik.Reporting.WebServiceDataSource.dll in my project and make sure it's exist in the running directory. But the error persists. And when the dll is not referenced, I can preview the report without problem. So the symptom seems not exactly same as the document describes. The dll version is 14.2.20.1021. .Net 4.8.
What else need be done to fix this error?
The text-transform: capitalize syntax is perfectly working when viewing in design tab of Htmlbox , but whenever I printpreview the report , the syntax is not working.
I provided some screenshots regarding to this issue, hope someone could help me out ,really need this feature so that I can use the capitalize text form.
Thanks in Advance.
I am programmatically generating a PDF from a TRDP file which uses an ObjectDataSource. When I preview my report using default values in the standalone report designer, the data is displayed correctly. When I set the parameters programatically and render the report in code, no data is displayed. Here is the code to generate the PDF. Appreciate any help.
Telerik.Reporting.UriReportSource reportSource =
new
Telerik.Reporting.UriReportSource
{
Uri =
"Reports\\MyReport.trdp"
};
reportSource.Parameters.Add(
new
Telerik.Reporting.Parameter(
"batchId"
, batchId));
reportSource.Parameters.Add(
new
Telerik.Reporting.Parameter(
"accession"
, accession));
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new
Telerik.Reporting.Processing.ReportProcessor();
System.Collections.Hashtable deviceInfo =
new
System.Collections.Hashtable();
var result = reportProcessor.RenderReport(
"PDF"
, reportSource, deviceInfo);
Hello. I am posting a question like this because I keep getting errors while using the report.
This problem only occurs on the project I am currently working on.
"An exception of type 'System.NullReferenceException' occurred in
PresentationFramework.dll but was not handled in user code Additional information
: Object reference not set to an instance of an object."
When creating a new project with the same reference, no error appears.
What is the problem? Leave the sauce below.
Telerik 2020.3.915.40 Version References(7)
Telerik.Windows.Controls Telerik.Windows.Controls.Chart Telerik.Windows.Controls.Data Telerik.Windows.Controls.GridView
Telerik.Windows.Controls.Input Telerik.Windows.Controls.Navigation Telerik.Windows.Data
TelerikReporting 14.2.20.916 Version References(5)
Telerik.Reporting Telerik.Reporting.OpenXmlRendering Telerik.Reporting.OpenXmlRendering Telerik.ReportViewer.Wpf Telerik.ReportViewer.Wpf.Themes
=Xaml======================================================================================
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SKC_QTO;component/Plugin/Themes/Report/System.Windows.xaml" />
<ResourceDictionary Source="pack://application:,,,/SKC_QTO;component/Plugin/Themes/Report/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/SKC_QTO;component/Plugin/Themes/Report/Telerik.Windows.Controls.Input.xaml" />
<ResourceDictionary Source="pack://application:,,,/SKC_QTO;component/Plugin/Themes/Report/Telerik.Windows.Controls.Navigation.xaml" />
<ResourceDictionary Source="pack://application:,,,/SKC_QTO;component/Plugin/Themes/Report/Telerik.ReportViewer.Wpf.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button x:Name="ChangeReportButton" Grid.Row="0" Height="30" Width="100" Command="{Binding ThisCommand}" Content="Change Report" Margin="0,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" >
</Button>
<tr:ReportViewer Grid.Row="1" x:Name="ReportViewer1" HorizontalAlignment="Stretch" ReportSource="{Binding MyReportSource}">
</tr:ReportViewer>
</Grid>
=Xaml.cs======================================================================================
public partial class ReportingView : Window
{
internal const string TelerikVersion = "2020.3.915.40";
internal const string TelerikPublicKeyToken = "~~~~~~~~~~";
internal const string Culture = "~~~~~~";
public ReportingView()
{
// This is for testing purposes. Assembly is initially registered at startup.
Assembly.Load($"Telerik.Windows.Controls, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Controls.Chart, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Controls.Data, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Controls.GridView, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Controls.Input, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Controls.Navigation, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
Assembly.Load($"Telerik.Windows.Data, Version={TelerikVersion}, Culture={Culture}, PublicKeyToken={TelerikPublicKeyToken}");
InitializeComponent(); <<<<< This Error ★★★★★★★★★★
this.DataContext = new ViewModel();
//DataContext = new ReportingViewModel();
}
}
=ViewModel.cs======================================================================================
class ViewModel : INotifyPropertyChanged
{
private int testCounter = 0;
public event PropertyChangedEventHandler PropertyChanged;
Telerik.Reporting.ReportSource _myReportSource;
public Telerik.Reporting.ReportSource MyReportSource
{
get { return this._myReportSource; }
set
{
if (this._myReportSource != value)
{
this._myReportSource = value;
if (null != this.PropertyChanged)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("MyReportSource"));
}
}
}
}
public ViewModel()
{
this.MyReportSource = new InstanceReportSource { ReportDocument = null };
_thisCommand = new Telerik.Windows.Controls.DelegateCommand(x => ChangeReport());
}
ICommand _thisCommand;
public ICommand ThisCommand
{
get
{
return _thisCommand;
}
}
public void ChangeReport()
{
if (testCounter % 2 == 1)
this.MyReportSource = new InstanceReportSource { ReportDocument = new Report1() };
else
this.MyReportSource = new InstanceReportSource { ReportDocument = null };
testCounter++;
}
============================================================================================
Thanks.
Currently running version R1 2020 SP1 (14.0.20.219) with the HTML 5 report viewer and the REST service ASP.NET Core 3.1
I am trying to set the database connection string dynamically using the method outlined in the knowledge base article below which passes it as a report parameter.
Change Connection String dynamically through a report parameter
This approach should be fine, however the issue is that I cannot find a way to modify the report parameters so that the connection string can be passed in.
I have tried to define a custom report resolver like the example below which adds the parameter to the report source. But I am finding that the parameter value does not get passed into the report.
We are using .trdp files as our report source and I have seen some examples where people have unpacked the file to return an InstanceReportSource. By doing this it might be possible to set the parameters against the report object directly.
Can anyone suggest a better way to set report parameters within the REST service (ie without passing the parameters from the client)?
Thanks
Andrew
public
class
CustomReportResolver : ReportFileResolver
{
private
readonly
IDdrConnectionService _ddr;
private
readonly
IHttpContextAccessor _httpContextAccessor;
public
CustomReportResolver(IDdrConnectionService ddr,
IHttpContextAccessor httpContextAccessor,
string
repositoryDirectory) :
base
(repositoryDirectory)
{
_ddr = ddr;
_httpContextAccessor = httpContextAccessor;
}
protected
override
ReportSource ResolveReport(
string
report)
{
ReportSource reportSource =
base
.ResolveReport(report);
Guid tenantId = _httpContextAccessor.HttpContext.User.GetTenantId();
string
connString = _ddr.GetShardConnectionString(tenantId);
reportSource.Parameters.Add(
"ConnectionString"
, connString);
return
reportSource;
}
}