How to make Free Hand SQL with Optional Filter
Answered
Hi,
I am trying to build a free hand SQL report with 2 filters - one mandatory and one optional.
Is there a way to use an optional filter in a freehand SQL report?
Hi Nitin,
Thanks for reaching out. This isn't possible due to the nature of Freehand SQL reports. Basically, your SQL query will have a WHERE clause in it with a {?} parameter, ostensibly turning the WHERE query into what's called a User Prompt Filter in YF, but nevertheless the WHERE query is still there in the report itself. If you put WHERE 'null' or '', that's of course still going to filter results because that's how SQL works with WHERE clauses. The only way to not include the filter would be to remove the entire WHERE clause, but if you need an optional filter then I don't think Freehand SQL Reports would be your solution. You may want to consider why Freehand SQL Reports are being looked at in the first place, if this is the case.
Hopefully this explanation makes sense. Please let me know if you have any other questions or concerns on this.
Regards,
Mike
Hi Nitin,
Thanks for reaching out. This isn't possible due to the nature of Freehand SQL reports. Basically, your SQL query will have a WHERE clause in it with a {?} parameter, ostensibly turning the WHERE query into what's called a User Prompt Filter in YF, but nevertheless the WHERE query is still there in the report itself. If you put WHERE 'null' or '', that's of course still going to filter results because that's how SQL works with WHERE clauses. The only way to not include the filter would be to remove the entire WHERE clause, but if you need an optional filter then I don't think Freehand SQL Reports would be your solution. You may want to consider why Freehand SQL Reports are being looked at in the first place, if this is the case.
Hopefully this explanation makes sense. Please let me know if you have any other questions or concerns on this.
Regards,
Mike
Replies have been locked on this page!