Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Test if a parameter matches a database value using ILIKE

$
0
0
I'm writing a report in report designer. One of the fields is name, and I essentially want to do this in my query:

Code:

WHERE tbl.field ILIKE '%${name}%'
However, I can't figure out a way to make this work in pentaho. The above query simply fails (I assume pentaho doesn't replace variables if they're in quotes). I can't do "WHERE ILIKE tbl.field ('%' || ${name} || '%'), because this fails when the name field is empty. If I apply a post-processing formula to surround the parameter with %s, the input textbox keeps getting filled with %s every time a field is updated. If I try using an open formula to represent %name%, it doesn't work because open formulae are calculated after the query is done.

I'm using Pentaho 4.8, on 64-bit Ubuntu 12.10; the database I'm connecting to is running PostgreSQL 9.0.13.

tl;dr: How can I have a SQL WHERE clause that is true if and only if an input parameter is contained in a database field?

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>