How do I Filter Data?

Stimulsoft Reports.NET discussion
Post Reply
User avatar
jp2code
Posts: 20
Joined: Thu Feb 11, 2016 9:10 pm
Location: Longview, TX [USA]

How do I Filter Data?

Post by jp2code »

I have Version 2015.3

Image

I can read in the Invoice data from our database.

I need to include numerous options that the end user will supply. One option is:

Which invoices to display?
  • All
  • Charge
  • Cash
Cash invoices have AmountDue=0. Charge invoices have AmountDue greater than 0.

I am passing in the parameter int value "p_intWhichInvoice".
  • If p_intWhichInvoice=0, return All
  • If p_intWhichInvoice=1, return Charge
  • If p_intWhichInvoice=2, return Cash
For 1 or 2, I just apply the filter.

For 0, I need to exclude the filter.

How would I write such a Filter in the Report editor?

Code: Select all

(p_intWhichInvoice == 1 ? 0 < VwInvoice.AmountDue : 
p_intWhichInvoice == 2 ? VwInvoice.AmountDue == 0 : 
1 == 1)
Is there a better way to write this?
~Joe
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How do I Filter Data?

Post by HighAley »

Hello, Joe.

This filter expression should be right.
If you don't get an expected result, please, send us your report template with sample data.

Thank you.
User avatar
jp2code
Posts: 20
Joined: Thu Feb 11, 2016 9:10 pm
Location: Longview, TX [USA]

Re: How do I Filter Data?

Post by jp2code »

Thanks HighAley. It does currently work.

The "1 == 1" part just looks like bad code.
~Joe
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: How do I Filter Data?

Post by Jan »

Hello, Joe!

Please try to use Choose and Switch functions.

Please contact us if you have any additional questions.

Thank you.
Attachments
Functions.png
Functions.png (15.5 KiB) Viewed 1701 times
Post Reply