Srihari
Srihari

Reputation: 2429

How to set two FilterString condtion on code Reports Winforms Devexpress?

am using devexpress winforms reports, I can able to set one filterString condition in code, this code is working successful

report.FilterString = "CompanyId =" + compid; 

and

DetailReport.FilterString = "CompanyId=" + compid; 

But now I need to set for two conditions I tried this code but it didn't filter display all values.

report.FilterString = "[CompanyId = " + compid +"] AND [ InvoiceStatus =" + status + "]";

Help me how to solve this ?

Upvotes: 1

Views: 1007

Answers (2)

Srihari
Srihari

Reputation: 2429

Thanks to all. Finally solved by this code and working fine for two filters using correct string formats.

report.FilterString = "InvoiceStatus = '" + status + "' AND CompanyId = " + compid;

Upvotes: 1

DmitryG
DmitryG

Reputation: 17848

The simplest filter syntax looks like this: "[FieldName] = Value".

Thus, change your code as follows:

report.FilterString = string.Format("[CompanyId] = {0} AND [InvoiceStatus] = {1}", compid, status);

Upvotes: 1

Related Questions