Srihari
Srihari

Reputation: 2429

How to write condition on Filter String in code Reports Winforms devexpress?

I designed a report form and map fields with columns of tables from dataset. Now I need to set condition, so I used FilterString. Inside report form DetailReport, I wrote code like this:

DetailReport.FilterString = "[InvoiceNumber] = " + temp;

Now I need this same code (FilterString) for whole form that is top left of form Report Task some properties are available in that Data Source there we add dataset, Data Member, Data Adapter then FilterString is available.

Now I am able to add FilterString in Designer but I need to add FilterString in code ?? I Tried this one but not working FilterString= "[InvoiceNumber] = " + temp" enter image description here

Upvotes: 0

Views: 4584

Answers (2)

SidAhmed
SidAhmed

Reputation: 2352

I seggest you set the report FilterString property when you call for your XtraReport (for example : when you click on the print button of your form). Here is an code example :

private void simpleButton1_Click(object sender, EventArgs e) {
    // Create a report instance.
    XtraReport1 report = new XtraReport1();

    // Some code like setting the report datasource

    // Specify the report's filter string.
    report.FilterString = "[InvoiceNumber] = myValue";

    // Show the report's print preview.
    pt.ShowPreviewDialog();
}

This code was taken from the DevExpress online documentation article : XtraReportBase.FilterString Property

Upvotes: 1

Milen
Milen

Reputation: 8877

Once you set the filter for the report, in the for you need to have it do:

 public string p = "";

....

  using (XtraReport_yourreport x = new XtraReport_yourreport ())
            {
                p = x.FilterString;

            }

Upvotes: 1

Related Questions