Page 1 of 1

How do I Filter Data?

Posted: Thu Feb 11, 2016 9:47 pm
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?

Re: How do I Filter Data?

Posted: Fri Feb 12, 2016 12:39 pm
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.

Re: How do I Filter Data?

Posted: Fri Feb 12, 2016 2:06 pm
by jp2code
Thanks HighAley. It does currently work.

The "1 == 1" part just looks like bad code.

Re: How do I Filter Data?

Posted: Sat Feb 13, 2016 11:37 pm
by Jan
Hello, Joe!

Please try to use Choose and Switch functions.

Please contact us if you have any additional questions.

Thank you.