Report showing blank and ignoring parameter

3 posts, 0 answers
  1. David
    David avatar
    51 posts
    Member since:
    Nov 2011

    Posted 31 Mar Link to this post

    I am using a demo of the reporting software but I am having issues understanding parameters I have set up the parameter Invoice_Number on the report parameters screenshot as per image 1.1. On My menu click of my UI I have calling a report viewer with the telerik report with the paramters.

     

    private void invoiceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Job job = jobsList.GetSelectedItem<Job>();
            if (job != null)
            {
                InvoiceReports INV = new InvoiceReports();
               INV.ReportParameters["Invoice_Number"].Value =job.InvoiceNumbers;
                InvoiceViewer _invViewer = new InvoiceViewer();
                _invViewer.Invoice_Number =job.InvoiceNumbers;
                   _invViewer.ShowDialog();
               
                //var sageInvoiceCoordinator = new SageInvoiceCoordinator();
                //  sageInvoiceCoordinator.Print(job.ID);
            }
        }

     

    In my invoice viewer cs i have the following which is setting the invoice itself.

     

    public string Invoice_Number { get; set; }
            public InvoiceViewer()
            {
                            InitializeComponent();
               
                
            }
            private void InvoiceViewer_Load(object sender, EventArgs e)
            {
                var report = new InvoiceReports();
                report.ReportParameters["Invoice_Number"].Value = Invoice_Number.ToString();
                
                // Use the InstanceReportSource to pass the report to the viewer for displaying
                var reportSource = new Telerik.Reporting.InstanceReportSource();
              //  reportSource.Parameters.Add(new Telerik.Reporting.Parameter("Invoice_Number", 3));
                reportSource.ReportDocument = report;
                // Assigning the report to the report viewer.
                reportViewer1.ReportSource = reportSource;
                // Calling the RefreshReport method in case this is a WinForms application.
                reportViewer1.RefreshReport();
            }
        }
     

     

    And as you can see below I added it to my sql data connection.  Im really at a loss as to what i am doing wrong

    SELECT        INVOICE.INVOICE_TYPE, INVOICE.INVOICE_OR_CREDIT, INVOICE.ACCOUNT_REF, INVOICE.NAME, INVOICE.ADDRESS_1, INVOICE.ADDRESS_2, INVOICE.ADDRESS_4, INVOICE.ADDRESS_5, INVOICE.ADDRESS_3,
                             INVOICE.C_ADDRESS_1, INVOICE.C_ADDRESS_2, INVOICE.C_ADDRESS_3, INVOICE.C_ADDRESS_4, INVOICE.C_ADDRESS_5, INVOICE.DEL_NAME, INVOICE.DEL_ADDRESS_1, INVOICE.DEL_ADDRESS_3,
                             INVOICE.DEL_ADDRESS_2, INVOICE.DEL_ADDRESS_5, INVOICE.DEL_ADDRESS_4, INVOICE.ORDER_NUMBER, INVOICE.CONTACT_NAME, INVOICE.ORDER_NUMBER_NUMERIC, INVOICE.CUST_ORDER_NUMBER,
                             INVOICE.CUST_TEL_NUMBER, INVOICE.NOTES_1, INVOICE.NOTES_2, INVOICE.NOTES_3, INVOICE.FOREIGN_ITEMS_GROSS, INVOICE.FOREIGN_ITEMS_TAX, INVOICE.FOREIGN_ITEMS_NET, INVOICE_ITEM.ITEM_NUMBER,
                             INVOICE_ITEM.JOB_NUMBER, INVOICE_ITEM.SERVICE_FLAG, INVOICE_ITEM.DESCRIPTION, INVOICE_ITEM.TEXT, INVOICE_ITEM.STOCK_CODE, INVOICE_ITEM.COMMENT_1, INVOICE_ITEM.COMMENT_2,
                             INVOICE_ITEM.FOREIGN_UNIT_PRICE, INVOICE_ITEM.FOREIGN_DISCOUNT_AMOUNT, INVOICE_ITEM.TAX_RATE, INVOICE.INVOICE_NUMBER, INVOICE.INVOICE_TYPE_CODE, COMPANY.L_NAME, COMPANY.L_ADDRESS_1,
                             COMPANY.L_ADDRESS_2, COMPANY.L_ADDRESS_3, COMPANY.L_ADDRESS_4, COMPANY.L_ADDRESS_5, COMPANY.TELEPHONE, COMPANY.FAX, COMPANY.E_MAIL, COMPANY.DEL_TELEPHONE, COMPANY.DEL_FAX,
                             COMPANY.DEL_E_MAIL, COMPANY.VAT_REG_NUMBER, COMPANY.NAME AS Expr1, INVOICE.INVOICE_DATE, INVOICE_ITEM.FOREIGN_FULL_NET_AMOUNT, INVOICE_ITEM.FOREIGN_NET_AMOUNT,
                             INVOICE_ITEM.FOREIGN_TAX_AMOUNT, INVOICE_ITEM.FOREIGN_GROSS_AMOUNT, INVOICE.FOREIGN_INVOICE_GROSS, INVOICE.FOREIGN_INVOICE_NET, INVOICE.CURRENCY_TYPE, INVOICE.CURRENCY,
                             INVOICE.FOREIGN_AMOUNT_PREPAID, INVOICE.ANALYSIS_1
    FROM            INVOICE, INVOICE_ITEM, COMPANY
    WHERE        INVOICE.INVOICE_NUMBER = INVOICE_ITEM.INVOICE_NUMBER AND (INVOICE.INVOICE_NUMBER = @INVOICE_NUMBER)

     

    Any Ideas

  2. David
    David avatar
    51 posts
    Member since:
    Nov 2011

    Posted 31 Mar in reply to David Link to this post

    Please note I am connecting to a sage 50 database which is ODBC compliant thanks.
  3. Nasko
    Admin
    Nasko avatar
    1050 posts

    Posted 03 Apr Link to this post

    Hello David,

    To find out what is going on we need to pinpoint whether the issue is in the application code setting the parameters, or in the report definition.

    To test the report definition, please open the report inside the Telerik Report Designer. Then set the Invoice_Number report parameter's Value and also set its Visible property to True. Now click Preview. If the report generates using the correct parameter value, then the report definition is correct and we will need to look into the application code as detailed below.

    To test the application code, please load the report as it was modified in the above instructions using just the code below:
    private void invoiceToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Job job = jobsList.GetSelectedItem<Job>();
        if (job != null)
        {
            InvoiceViewer _invViewer = new InvoiceViewer();
            _invViewer.Invoice_Number = job.InvoiceNumbers;
            _invViewer.ShowDialog();
        }
    }

    public string Invoice_Number { get; set; }
        public InvoiceViewer()
        {
            InitializeComponent();
        }
     
        private void InvoiceViewer_Load(object sender, EventArgs e)
        {
            var report = new InvoiceReports();
            // Use the InstanceReportSource to pass the report to the viewer for displaying
            var reportSource = new Telerik.Reporting.InstanceReportSource();
            reportSource.Parameters.Add("Invoice_Number", 3);
            reportSource.ReportDocument = report;
            // Assigning the report to the report viewer.
            reportViewer1.ReportSource = reportSource;
            // Calling the RefreshReport method in case this is a WinForms application.
            reportViewer1.RefreshReport();
        }
    }

    And check if the report parameter value, which is now visible in the report viewer's parameters area is the default value set in the report definition, or the value added to the reportSource.Parameters via the code above.

    Another tool you can use to gain insight is a SQL Server Profiler or a similar tool which can sniff the actual SQL query sent to the server and examine the parameter value there.

    Regards,
    Nasko
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top