Groovy web console

subscribe to the feed Subscribe
to this
site
buildQuery (via #groovywebconsole)
tweet this snippet Tweet
this
script

buildQuery

Published 8 months ago by nmrao with tags query sql
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def query = 'select CORR.Preferred as preferred, CORR.Category as category,CORR.Currency as currency from BENEFICIARY CORR JOIN LOCATION LOC on CORR.UID = LOC.UID  and CORR.BeneficiaryID LIKE \'ABC123\''
currencyValue = 'USD'
categoryValue = 'Commercial'
currencyValue ? (query += " and CORR.Currency LIKE '${currencyValue}'") : query
categoryValue ? (query += " and CORR.Category LIKE '${categoryValue}'") : query