2a8dfda1fb409e1c33e0e9ef297607c541502137
FAQ/Questions/Injecting-where-clause-into-queries.md
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +#Injecting a "Where" Clause Into Queries |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##Question |
|
| 6 | + |
|
| 7 | +Can I inject SQL "Where Clause" or other expressions into a query or queries? |
|
| 8 | + |
|
| 9 | +##Answer |
|
| 10 | + |
|
| 11 | +Yes, you can perform this in a couple of ways. |
|
| 12 | + |
|
| 13 | +Lets say you have the following situation: |
|
| 14 | + |
|
| 15 | +You have 2 views: invoices and payments. But when you run a report where the invoice date is a range and you want to display any blank payments also included in this report, you will have an issue where the payment date will show blanks if the payment amount is blank. |
|
| 16 | + |
|
| 17 | +There are 2 basic ways to address this problem. |
|
| 18 | + |
|
| 19 | +**Method 1:** |
|
| 20 | + |
|
| 21 | +In your filter, select **[[Use Previous Or|http://wiki.izenda.us/FAQ/Questions/How-is-Use-Previous-OR-used-in-Filters]]** to bring in payments. |
|
| 22 | + |
|
| 23 | +**Method 2:** |
|
| 24 | + |
|
| 25 | +You can also use the SQL Override property in the [[PreExecuteReportSet|]] method to inject a 'Where' clause. Please see the hidden filter with Sql Override section in [[this article|http://wiki.izenda.us/FAQ/applying-hidden-filter-using-inner-query]]. |
|
| ... | ... | \ No newline at end of file |