Telerik Forums
Reporting Forum
5 answers
468 views

I have been searching and reading for the last 4 hours to find any resource to create an objectdatasource for an Asp.net Core application.  All the samples use framework 4+.  I have three tiers in my application the first layer is the Entity/Model layer the middle tier is the service layer/Business logic layer and the final tier is the Web/UI layer.

I have successfully created a reportviewer that displays an embedded sql with parameters but what I am trying to do is to take an IQueryable<T> from the service layer and populate the report.  Is there an example available?

Todor
Telerik team
 answered on 03 Feb 2020
1 answer
599 views
Is it possible to generate QR Code of an image or pdf document in telerik reporting
Neli
Telerik team
 answered on 03 Feb 2020
1 answer
87 views

Hi all,

I am trying to Encrypt the password in the telerik designer report source , kindly help me to resolve this issue.Image is attached for reference.

Todor
Telerik team
 answered on 31 Jan 2020
1 answer
102 views

Hi, currently I'm create table report programmatically. Here I attach the code for generate the report in <report>. Then I call the report in user control form. In the user control form, I create the filter button "proceed". Then I do the filter in the UC form and I pass the filter in the GetData() function in <report>. The problem is the parameter value is reset then it will generate the report before filter. The parameter value I set in User control form <ucReport>. The picture shows that I have done filter the search by date from 1/1/2020 - 15/1/2020. But the table not filter. 

<report>

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using Telerik.Reporting.Charting;
using Telerik.Reporting.Processing;
using MYScanLibrary;
using System.Data;

namespace MYScanDesktop
{


    /// <summary>
    /// Summary description for Report2.
    /// </summary>
    public partial class jkdmReport1 : Telerik.Reporting.Report
    {
        System.ComponentModel.BindingList<Entry> ReportEntry;

        // private List<Graph> GraphData;
        private string testfilter = "";
        public jkdmReport1()
        {
            //
            // Required for telerik Reporting designer support
            //
            InitializeComponent();
            ReportEntry = new System.ComponentModel.BindingList<Entry>();
            GenerateReport();
            
           
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        public void setFilter(String f)
        {
            testfilter = f;
           MessageBox.Show("testfilter1: " + testfilter);
        }

        public String getFilter()
        {
            
            return testfilter;
           
        }

        public DataTable GetData()
        {
            //String filter = a;
            ReportEntry.Clear();
            dynamic table = new DataTable();

           // this.StartDate.Value = "= Parameters.StartDate.Value";
           
            MessageBox.Show(StartDate.Value.ToString());
            
            int myentry = Program.myScanDB.queryEntry(ReportEntry, testfilter);
           
            table.Columns.Add("ID", typeof(string));
            table.Columns.Add("DateTime", typeof(string));
            table.Columns.Add("Gate", typeof(string));
            table.Columns.Add("Lane", typeof(string));
            table.Columns.Add("LPN", typeof(string));
            table.Columns.Add("BackLPN", typeof(string));
            table.Columns.Add("ContainerNo", typeof(string));
            table.Columns.Add("BackContainerNo", typeof(string));
            table.Columns.Add("WIM", typeof(string));
            table.Columns.Add("WIMDoc", typeof(string));
            table.Columns.Add("Wheel Base", typeof(string));
            table.Columns.Add("RM", typeof(string));
            table.Columns.Add("Status", typeof(string));

            for (int i = 0; i < myentry; i++)
            {
                //add data rows value in each column
                table.Rows.Add(
                    ReportEntry[i].ID.ToString(),
                    ReportEntry[i].Datetime.ToString(),
                    ReportEntry[i].Gate.ToString(),
                    ReportEntry[i].Lane.ToString(),
                    ReportEntry[i].LPN.ToString(),
                    ReportEntry[i].BackLPN.ToString(),
                    ReportEntry[i].ContainerNum.ToString(),
                    ReportEntry[i].BackContainerNum.ToString(),
                    ReportEntry[i].WIM.ToString(),
                    ReportEntry[i].WIMDoc.ToString(),
                    ReportEntry[i].WheelBase.ToString(),
                    ReportEntry[i].RM.ToString(),
                    ReportEntry[i].Status.ToString()
                    );
            }

            return table;
        }

      
        public void GenerateReport()
        {
            ReportEntry.Clear();
            //create a blank Table item
            Telerik.Reporting.Table table1 = new Telerik.Reporting.Table();
           
            table1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.6), Telerik.Reporting.Drawing.Unit.Inch(0.6));
            table1.Name = "Table1";
            table1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(4), Telerik.Reporting.Drawing.Unit.Inch(1));

            //get the data for the table
            DataTable data = GetData();
            table1.DataSource = data;

            //create a dynamic row group
            Telerik.Reporting.TableGroup DetailRowGroup = new Telerik.Reporting.TableGroup();
            DetailRowGroup.Groupings.Add(new Telerik.Reporting.Grouping(null));
            DetailRowGroup.Name = "DetailRowGroup";
            table1.RowGroups.Add(DetailRowGroup);
            //add a row container
            table1.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(Telerik.Reporting.Drawing.Unit.Inch(0.5)));
            table1.ColumnHeadersPrintOnEveryPage = true;
            table1.RowHeadersPrintOnEveryPage = true;

            //add columns
            for (int i = 0; i <= data.Columns.Count - 1; i++)
            {
                //add a column container
                table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(2)));
                //add a static column group per data field
                Telerik.Reporting.TableGroup columnGroup = new Telerik.Reporting.TableGroup();
                table1.ColumnGroups.Add(columnGroup);

                //header textbox
                Telerik.Reporting.TextBox headerTextBox = new Telerik.Reporting.TextBox();
                headerTextBox.Name = "headerTextBox" + i.ToString();
                headerTextBox.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.571D), Telerik.Reporting.Drawing.Unit.Inch(0.533D));
                headerTextBox.Value = data.Columns[i].ColumnName;
                headerTextBox.Style.BackgroundColor = System.Drawing.SystemColors.HotTrack;
                headerTextBox.Style.Color = System.Drawing.Color.White;
                headerTextBox.Style.Font.Bold = true;
                headerTextBox.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(8D);
                headerTextBox.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
                headerTextBox.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
                headerTextBox.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
                //  headerTextBox.Style.BorderWidth.Default = Telerik.Reporting.Drawing.Unit.Pixel(1);
                columnGroup.ReportItem = headerTextBox;

                //field that will be displayed
                Telerik.Reporting.TextBox detailRowTextBox = new Telerik.Reporting.TextBox();
                detailRowTextBox.Name = "detailRowTextBox" + i.ToString();
                detailRowTextBox.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.572D), Telerik.Reporting.Drawing.Unit.Inch(0.3D));
                detailRowTextBox.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
                detailRowTextBox.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
                detailRowTextBox.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
                detailRowTextBox.Value = "= Fields.[" + data.Columns[i].ColumnName + "]";
                table1.Body.SetCellContent(0, i, detailRowTextBox);

                //add the nested items in the Table.Items collection
                table1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { headerTextBox, detailRowTextBox });
            }

       

            this.DetailSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { table1});

        }
    }
}

 

 

 

<ucReport>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.Reporting;
using MYScanLibrary;
using Telerik.Reporting.Drawing;
using Telerik.Reporting.Charting;

namespace MYScanDesktop
{


    public partial class ucReporting : UserControl
    {
        jkdmReport1 myReport = new jkdmReport1();
        Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
       
        public ucReporting()
        {
            InitializeComponent();
           
            typeReportSource.TypeName = typeof(jkdmReport1).AssemblyQualifiedName;
            LoadReport();      
        }

        private void LoadReport()
        {
            
            //add parameter
            typeReportSource.Parameters.Add(new Telerik.Reporting.Parameter("Location", "efd"));
            
            String textStartDate = String.Format("{0}", this.datetimePickerStart.Value.ToString("dd/MM/yyyy hh:mm:ss"));
            String textEndDate = String.Format("{0}", this.datetimePickerEnd.Value.ToString("dd/MM/yyyy hh:mm:ss"));
          
            typeReportSource.Parameters.Add(new Telerik.Reporting.Parameter("StartDate", textStartDate));
            typeReportSource.Parameters.Add(new Telerik.Reporting.Parameter("EndDate", textEndDate));
            typeReportSource.Parameters.AddRange(new ParameterCollection());


            //MessageBox.Show(textStartDate.ToString());
            reportviewerMain.ReportSource = typeReportSource;

            reportviewerMain.RefreshReport();
        }

        private void buttonProceed_Click(object sender, EventArgs e)
        {
        
            String whereFilter = String.Format(" WHERE et_datetime >= '{0}' AND  et_datetime <= '{1}'",
                    this.datetimePickerStart.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                    this.datetimePickerEnd.Value.ToString("yyyy-MM-dd HH:mm:ss"));
            myReport.setFilter(whereFilter);
            LoadReport();
            
        }

       
    }

}

Todor
Telerik team
 answered on 31 Jan 2020
2 answers
383 views

Is it possible to use .net core dependency injection into the object set as the data source to an ObjectDataSource?

Such that...

 

[DataObject]
class Products
{
    private readonly IProductRepo _repo;
 
    public Products(IProductRepo repo
    {
         _repo = repo;
    }
 
 
    [DataObjectMethod(DataObjectMethodType.Select)]
    public IEnumerable<Prodcut> GetProducts()
    {
       _repo.GetProducts();
    }
}
Vitaliy
Top achievements
Rank 1
 answered on 30 Jan 2020
4 answers
1.2K+ views

Hi,

 

I would like to use checkbox in my report.

Selecting check box should display data and deselecting should not display data in report.

How to achieve above in Telerik report designer.

Thank you.

Web
Top achievements
Rank 1
 answered on 29 Jan 2020
1 answer
290 views

Hi all, 

I'm attempting to create a report using the standalone Report Designer. Whenever I try to run the report, I get the below error;

MySql.Data.MySqlClient.MySqlException

at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)\r\n  
at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)\r\n  
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()\r\n  
at Telerik.Reporting.Processing.Data.SqlDataEnumerable.<GetEnumerator>d__0.MoveNext()\r\n  
at Telerik.Reporting.Processing.Data.SeedDataAdapter.GroupData(IEnumerable`1 rawData)\r\n  
at Telerik.Reporting.Processing.Data.SeedDataAdapter.Execute(IEnumerable`1 data)\r\n  
at Telerik.Reporting.Processing.Data.ResultSetAdapter.Execute(IEnumerable`1 data)\r\n  
at Telerik.Reporting.Processing.Data.MultidimentionalDataProvider.Execute(MultidimensionalQuery query)\r\n  
at Telerik.Reporting.Processing.ReportParametersManager`1.CalculateParameterProperties(P parameter, IReportParameter parameterDef, IDictionary`2 parameterValues, Boolean parentChanged)\r\n  
at Telerik.Reporting.Processing.ReportParametersManager`1.Calculate(P parameter, IDictionary`2 parameterValues, Boolean parentChanged, Boolean& valueChanged)\r\n  
at Telerik.Reporting.Processing.ReportParametersManager`1.RecalculateParameters(IDictionary`2 parameterValues)\r\n  
at Telerik.Reporting.Processing.DocumentParametersManager`1.CalculateParameters(IDictionary`2 values)\r\n  
at Telerik.Reporting.Processing.DocumentParametersManager`1.GetMergedParameters(IDictionary`2 values)\r\n  
at Telerik.Reporting.Services.Engine.ReportEngine.GetParameters(String clientID, String report, Dictionary`2 parameterValues)\r\n  
at Telerik.Reporting.Services.WebApi.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource)\r\n  
at Telerik.ReportServer.Web.Controllers.Api.ReportsController.<>c__DisplayClassf.<GetParameters>b__e()\r\n  
at Telerik.ReportServer.Web.Controllers.Api.ReportsController.DoIfUserAvailable(Func`1 action)\r\n  
at Telerik.ReportServer.Web.Controllers.Api.ReportsController.GetParameters(String clientID, ClientReportSource reportSource)\r\n  
at lambda_method(Closure , Object , Object[] )\r\n  
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)\r\n  
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n  
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n  
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n  
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n  
at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n  
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n  
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()"

 

Can anyone please give me some insight as to why this is happening? If you need more information, please let me know.

 

Thanks!

 

Neli
Telerik team
 answered on 28 Jan 2020
1 answer
94 views
I already have the design of my report, what I need to know is how I have to call the button that I have in my view to show me my Report.
What do I have to define in the controller?

regards
Todor
Telerik team
 answered on 28 Jan 2020
1 answer
1.1K+ views

 

Hello,

I wanted to know how to set the parameters datasource list to appear as a dropdown and not the way they are showing in the attached image. I don't see any kind of option to make it a dropdownlist as I thought this was default behavior.

 

Todor
Telerik team
 answered on 28 Jan 2020
1 answer
2.7K+ views

Hello,

I have several panels in a report.  Each panel is stacked on the other.  When the underlying field value in one of the panels =IsNullOrEmpty(Fields.mspecifications), I want the entire panel to go away for that report and the other panels to move up and take the place of the panel that has no data.

How do I make this happen? 

In My Crystal Report, I simply check the "Suppress Blank Section" checkbox.

Thanks,

TFISHER

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 27 Jan 2020
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?