SQLTeam.com | Weblogs | Forums

Parameters limiting my results


I have a SSRS report I created that is using about 6 different parameters to help the user filter their results. I have the parameters set to allow blanks as well in case they want to run it wide-open.

My problem is when the report is ran wide open, I'm not getting all the results I should be.

If I delete the parameters entirely from the report, I get the expected number of returns.

I don't understand why just having the parameters in the report, even though they're blank, is affecting the output.

Hope that makes sense.


I am not familiar with SSRS but I am curious about this.

When you do that do you have to code the WHERE clause accordingly in SSRS, or does it "take care of it for you behind the scenes"?

If you have to code it then I reckon folk here will need to see the code to find what is causing it to return the wrong results.


I agree, we need to see the code. What you are trying to do is very common but how it is implemented in SSRS is dependent on how you have your SQL written to filter rows.


attached is the query, thanks all

**invend.fac AS [Location], **
**invend.fpartno AS [PDI Part], **
**inmast.fdescript AS [PDI Desc], **
**invend.fpartrev AS [PDI Rev], **
inmast.fgroup AS [GC],
**inmast.fprodcl AS [PC], **
apvend.fcompany AS [Vendor],
**--invend.fvendno AS [Vend #], **
**invend.fvpartno AS [Vend Part], **
**invend.fvptdes AS [Vend Part Desc], **
mfr.fcmfrname as [MFG],
mfrpart.fcmfrpart as [MFG Part],
mfrpart.fmcomments as [MFG Comments],
inmast.fstdmemo as [Item Master Memo] ,
**inmast.fcomment as [Item Master Comment] **

from invend

inmast ON (invend.fpartno + invend.fpartrev + invend.fac) = (inmast.fpartno + inmast.frev + inmast.fac)

mfrpart ON inmast.fpartno = mfrpart.fcpartno

mfr ON mfrpart.fcmfrno = mfr.fcmfrno

apvend ON invend.fvendno = apvend.fvendno

(inmast.fdescript LIKE '%' + @pdiDesc + '%')
(mfrpart.fcmfrpart LIKE '%' + @mfgPart + '%')
(apvend.fcompany LIKE '%' + @vendName + '%')
(mfr.fcmfrname LIKE '%' + @mfgName + '%')
(inmast.fstdmemo LIKE '%' + @imMemo + '%')
(inmast.fcomment LIKE '%' + @imComment + '%')


That, and the others like it, will exclude all rows where inmast.fdescrip IS NULL

(@pdiDesc IS NULL OR inmast.fdescript LIKE '%' + @pdiDesc + '%')
AND (...

will take care of that. (If your blank parameter is "blank" rather than NULL you would need

(@pdiDesc = '' OR ...)
AND (...


Here is an alternative you would want to consider that includes what Kristen posted:

All Parameter Reports

Granted, if you need the wildcard matching, it complicates things. If you can get away from that and load values for parameters with specific values, it makes it easier and you get away from having to use LIKE.


You may have a reason for concatenating the columns together for comparison, but if not

LEFT JOIN inmast
     ON invend.fpartno = inmast.fpartno
    AND invend.fpartrev = inmast.frev
    AND invend.fac = inmast.fac

will be MUCH more efficient if there is a suitable index available


this worked, thanks so much!!