Comparing 'selected' record instead of 'First' record in SSRS expression

  • I'm building an SSRS report using visual studio 2008 in a SQL 2008 environment. The report uses the following parameters: EmployeeID, Payroll Date and an employee PIN. The dataset for the main report returns a list of active employee IDs and their associated pins. It calls a sub report that displays clock in / clock out and work transaction data for the selected employee ID. I need to hide the subreport if the pin entered does not match the pin on file for the employee ID selected from the dropdown.
    The problem I'm encountering is that the expression for the visibility property of the sub report is comparing the entered pin parameter to only the 'First' record from the employee list dataset rather than that of the record for the 'selected 'employee ID. If the pin for the 'first' record is entered subreport will display the correct results for the selected employee.

    Here is the text of the expression:
    =Parameters!Pin.Value <> First(Fields!Pin.Value, "EmployeeSelect")

    If I remove the 'first' from the expression I end up with this error:
    "The Visibility.Hidden expression for the subreport myreportname contains an error: [BC30198] ')' expected."

    This seems like it shouldn't be that difficult but obviously what I am doing is wrong. I don't know how to make it compare against the selected employees pin instead of the first employees pin. Can anyone offer some direction on how to accomplish this? Thanks in advance!

  • What if you didn't hide the sub-report?  Instead, what if you passed in the PIN to the sub-report as a parameter.  Then, within the sub-report you set the visibility on the table (or whatever you are using to show the data)?  If you go with this approach, the value that gets passed to the sub-report should always be correct.

    Hopefully I'm understanding you correctly 😉

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply