Jump to content
We've recently updated our Privacy Statement, available here ×

Adhoc Filters Case insensitive for Ends With Condition


karthik.clarity

Recommended Posts

Hello Champs,

We have a requirement where we need to make adhoc filters as Case insensitive and we are on Oracle, so we mofidied applicationContext-semanticLayer.xml

As per this article - http://community.jaspersoft.com/wiki/how-enable-case-insensitive-search-adhoc-filters-oracle-db

And I am able to make it work for Starts with by adding ^ in the regular expression and it worked with no issues

return " regexp_like(" + sqlArgs[0] + "," + "'^" + search.replace("'","''") + "', 'i')"

But I am trying to change it for Ends with so it should be $ so I tried with below line but ended up with no luck and Ends with stopped working.

return " regexp_like(" + sqlArgs[0] + "," + "'" + search.replace("'","''") + "$', 'i')"

 

 

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

It is fixed now. For other readers benefit, here is the solution

$ in grovvy needs to be escaped by

So here is the xml snippet 

 

 <entry key="EndsWith">
                    <value>
                        def search = args[1].value;
                        if (search == null)
                        return sqlArgs[0] + " like '%' || " + sqlArgs[1]
                        if (! (search instanceof String)) { search = search.value }
                        return " regexp_like(" + sqlArgs[0] + "," + "'" + search.replace("'","''") + "$', 'i')"
                    </value>
                </entry>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...