This is a migrated thread and some comments may be shown as answers.

URGENT:Create filters

11 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manuel
Top achievements
Rank 1
Manuel asked on 22 Dec 2011, 03:45 PM
Hi telerik,

I´m new in telerik's reporting and after created my report, I want create filters for that, for exemple, imagine that I have a list of products and I want filter them for Date or something else.

How I can do that? I cannot find any info about this in the internet.

Thanks for the help,

11 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 23 Dec 2011, 02:37 PM
Hello Manuel,

Check the following help articles for more information:

Kind regards,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Manuel
Top achievements
Rank 1
answered on 26 Dec 2011, 12:28 PM
Hello Steve,

Yes, I understand that, but how I can create filters for user use, like some comboBox that will filter by date for example. In the ToolBox of report design there is no ComboBox control...

There is any source code telerik's example? For exemple in this demo you have a comboBox that filter the years, how I can do like that?

https://demos.telerik.com/reporting/sales-dashboard/silverlight-demo.aspx

Thanks,
0
Manuel
Top achievements
Rank 1
answered on 26 Dec 2011, 03:21 PM
OK, I´m already create the filter, but now I have this problem, please look at picture. This error happens when I select the filter value and then click in "preview".

I followed this tutorial: http://demos.telerik.com/reporting/sales-dashboard/video.aspx.

Any idea what error is that?

Thanks



0
Steve
Telerik team
answered on 27 Dec 2011, 03:38 PM
Hello Manuel,

The error you've received is generic one and is up to the point - there is already an item with the same key. This usually means that you're trying to add an item (filter or report parameter) with the same key to a collection. The idea behind filtering a report via report parameters is pretty straight-forward. The filter expression depends on the value of an existing Report Parameter which the user changes via the built-in report parameters area. There is no need for you to manually create the filters or report parameters in your app, on the contrary we've eased that process to a minimum by allowing you to create both the report parameter and the filter in the report definition and still have the ability to change the resulting report via the report parameter filtering. The dashboard report demo is a good example of this and another one is the Product Line Sales report. Review them carefully and apply the same approach to your reports.

Kind regards,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Manuel
Top achievements
Rank 1
answered on 27 Dec 2011, 06:18 PM
Hi Steve,

I follow the tutorial but when I configure the sqlDataSource and write my query with the filter like this:

Select ID,PODE_VOTAR FROM PARTICIPANTES_REUNIAO
WHERE PODE_VOTAR = @Filtrar

Bu when i do "Next" to go for the next step that should be "configure sqlDataSource Parameters" I can´t, because goes to preview window.

I can´t understand what i´m doing wrong.


Another question, I have in my database numeric fields, but in filter, I need that number 1 in DB is a YES in report. How I can do that? I tried user function but no lucky.

I will send these 3 images to help understand the error.

And if you prefere I can´t go to step number 4 of this tutorial: http://www.telerik.com/help/reporting/sqldatasource-wizard.html

Thanks
0
Elian
Telerik team
answered on 28 Dec 2011, 05:01 PM
Hello,

Up to your questions:
  1. Judging by the error it looks like there is a problem with the data provider. Please check the list of supported providers for sqlDataSource. Also check the how-to articles for more info on connecting to different types of db-s. If your db is Oracle we suggest to use the Oracle Data Provider for .NET (Oracle.DataAccess.Client ).
    Make sure that your provider is working correctly and is present in the supported list.
  2. Check the IIF() function. IIF(Fields.Number == 1, True, False)
Kind regards,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Manuel
Top achievements
Rank 1
answered on 30 Dec 2011, 10:32 AM
Hello Elian,

Thanks for the answer. About my first question, the problem is not of database connection. It's true that i´m using oracle database and my Provider is Oracle.DataAccess.Client as you can see here:

 public AssuntosReuniao()
        {
            InitializeComponent();
            this.ReportParameters.Add("REUNIAOID", ReportParameterType.Integer, null);
            this.DataSource = null;
            this.NeedDataSource += new EventHandler(ReportAssuntosReuniao_NeedDataSource);
        }

        void ReportAssuntosReuniao_NeedDataSource(object sender, EventArgs e)
        {

            report = (Telerik.Reporting.Processing.Report)sender;

            this.sqlDataSource1.Parameters[0].Value = report.Parameters["REUNIAOID"].Value;

            this.sqlDataSource1.ConnectionString = ReportClass.main.ConnectionString;
            this.sqlDataSource1.Name = "sqlDataSource1";
            this.sqlDataSource1.ProviderName = ReportClass.main.ProviderName;

            this.sqlDataSource1.SelectCommand = "SELECT TIPOS_REUNIAO.DESIGNACAO AS TR_DESIGNACAO, REUNIOES.DESIGNACAO, REUNIOES.DATA_HORA_PREVISTA_INICIO, ASSUNTOS.DESIGNACAO AS EXPR1, ASSUNTOS.CONTEUDO, ASSUNTOS.RESULTADO_VOTACAO, REUNIOES.TIPO_REUNIAO_ID FROM ASSUNTOS, REUNIOES,TIPOS_REUNIAO WHERE ASSUNTOS.reuniao_id = REUNIOES.id AND REUNIOES.id = " + sqlDataSource1.Parameters[0].Value + "AND TIPOS_REUNIAO.ID = REUNIOES.TIPO_REUNIAO_ID";

            report.DataSource = this.sqlDataSource1;

            
        }

Where the ReportClass.main.ConnectionString and ReportClass.main.ProviderName I read from my webConfig and ProviderName is Oracle.DataAccess.Client.

Have you some example that I can see the source code?

Thanks,
0
Manuel
Top achievements
Rank 1
answered on 30 Dec 2011, 10:45 AM
Hi,

I already figure out the problem. As I´m using a oracle database the parameters are prefixed by ":" and not for "@".

Thanks
0
Manuel
Top achievements
Rank 1
answered on 30 Dec 2011, 11:21 AM
But now I have another problem. Now, after detect my report parameter in sql query, the wizard ask me for a design runtime value, and after I put the value and tried run the query I got an ORA-00972 identifier is too long. The question is: what identifier is too long?
0
Manuel
Top achievements
Rank 1
answered on 30 Dec 2011, 03:19 PM
Hi,
And about the IIF function, you suggest IIF(Fields.Number == 1, True, False), but instead of True or False I want show "Yes" or "No" in filter of report. (please see the attach)

I tried do that  = IIf(Fields.PODE_VOTAR == 1,'Sim','Não') but give this error: Missing operand before '=' operator

What i´m doing wrong?

Thanks in advance
0
Manuel
Top achievements
Rank 1
answered on 30 Dec 2011, 06:24 PM
Hi,

I fix it again :)

Thanks
Tags
General Discussions
Asked by
Manuel
Top achievements
Rank 1
Answers by
Steve
Telerik team
Manuel
Top achievements
Rank 1
Elian
Telerik team
Share this question
or