Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
SQL Query Parameter issues
drusso17
I am using BIRT to write reports for IBM's Maximo 7 software.<br />
<br />
I am using the following SQL query for a report:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
select
dbo.workorder.wonum,
dbo.workorder.description,
dbo.workorder.worktype,
dbo.workorder.status,
dbo.workorder.wopriority,
dbo.workorder.location,
dbo.workorder.actfinish,
dbo.workorder.reportdate,
dbo.workorder.failurecode,
dbo.workorder.wo3,
fc.description,
locs.description
from
dbo.workorder
--Bring in Description of Failure Class:
left outer join dbo.failurecode as fc on dbo.workorder.failurecode=fc.failurecode
--Bring in Address of Loaction:
left outer join dbo.locations as locs on dbo.workorder.location=locs.location
where
dbo.workorder.status='COMP'
and
dbo.workorder.actfinish >= ?
and
dbo.workorder.actfinish <= ?
and
dbo.workorder.location like ?
</pre>
<br />
The first to parameters work fine (start and end date). But the last parameter is giving me a headache.<br />
<br />
The way Maximo creates work orders is ABC-012345 where ABC is the location and 012345 is the actual work order number, however these are not stored in separate locations. So the last parameter works if I replace the line with:<br />
"dbo.workorder.location like 'ABC%' "<br />
but if I use any of these:<br />
"dbo.workorder.location like ? "<br />
"dbo.workorder.location like '?' "<br />
"dbo.workorder.location like '?%' "<br />
or anything similar (I swear I've tried them all), it does not return any results when the user enters "ABC%" in the parameter menu when running the report<br />
<br />
Any and all help would be greatly appreciated!
Find more posts tagged with
Comments
bhanley
Have a look a this DevShare post. It should get things working for you.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/864-use-a-like-operator-in-a-query/#description'>Use
a LIKE operator in a query - Designs & Code - BIRT Exchange</a> <br />
<br />
Good Luck!
drusso17
That's exactly what I ended up doing! Works great! Thanks!
rahmanz
what I did is use like operator in my query and added parameter ?. and when i send parameter i added '%' + param_value + '%'. It works perfect. If you send param % in url it will not work as because i think % is treaded as space.
Ripon