Answered SSRS Lookup Function

  • Friday, February 08, 2013 9:47 PM
     
     

    I have a textbox, which I want to just display the RowNumber that is located in another table based upon

    Here is my lookup which does not work:

    It wants to see an aggregate. There is only one distinct value with "RM 1005" in the Fields!RoomNo.Value column for the dataset, and I want to display the RowId.

    What is wrong here?

    =Lookup(Fields!RoomNo.Value,

    "RM 1055", Fields!RowId.Value, "dsCheckInSteps")

All Replies

  • Friday, February 08, 2013 10:22 PM
     
     

    Are you using Report builder 3.0?

    Also check MSDN link here with more clear example.

    http://technet.microsoft.com/en-us/library/ee210450(SQL.105).aspx


    Please Mark posts as answers or helpful so that others can more easily find the answers they seek.

  • Friday, February 08, 2013 10:34 PM
     
     

    Hello, I tried that, and it again, does not seem to work.

    I am not using builder, just ssrs 2008r2

  • Monday, February 11, 2013 8:07 AM
    Moderator
     
     Answered

    Hi Jmcpsd,

    The syntax of lookup function is:Lookup(source_expression, destination_expression, result_expression, dataset)

    1. source_expression: (Variant) An expression that is evaluated in the current scope and that specifies the name or key to look up. For example, =Fields!ProdID.Value.
    2. destination_expression: (Variant) An expression that is evaluated for each row in a dataset and that specifies the name or key to match on. For example, =Fields!ProductID.Value.
    3. result_expression: (Variant) An expression that is evaluated for the row in the dataset where source_expression = destination_expression, and that specifies the value to retrieve. For example, =Fields!ProductName.Value.
    4. dataset: A constant that specifies the name of a dataset in the report. For example, "Products".

    In your expression, you pass a string as the second parameters of the lookup function. You should change it to a filed value in the dataset.
    =Lookup(Fields!RoomNo.Value,Fields!Column.Value,Fields!RowId.Value,"dsCheckInSteps")

    If you have any questions, please feel free to ask.

    Regards,
    Charlie Liao

    If you have any feedback on our support, please click here.


    Charlie Liao
    TechNet Community Support

    • Marked As Answer by jmcpsd Wednesday, February 13, 2013 8:15 PM
    •