How to get the Label Field from a parameter

  • Hello,

    I have a report parameter defined like this:

    Available Values: "Get values from a query" using a dataset called "ClientList". This dataset contains the query "SELECT ClientId, ClientName FROM tClient".

    The parameter's Value field is set to "ClientId" and the Label Field is set to ClientName.

    This allows me to see a list of client names, and I can use the @ClientId parameter in my report.

    But I also need the ClientName of the selected client to display on the report. How do I obtain this?

  • I am not sure I understand your question. What do you want to see on the report, and where on the report do you want to see it?

  • One the user has selected a client, the @Client parameter is populated with the value of ClientID from the query. I can then use the @Client parameter variable in the query for the report's Dataset to retrieve data for just that client.

    What I want to do is display the ClientName in the report header. But the parameter only seems to make the ClientId available.

  • Add another parameter, make it hidden, and associate the company name with it. Then add that parameter to the header as you did with the client id.

  • That could work. How do I do the "associate the company name with it" bit?

  • Give your parameter a default value based on the query that gives the company name.

  • Hi,

    I tried this with a scenario...(Hope..I am not missing anything here..but do let me know..if my understanding is not correct :)...)

    -- Created a dataset1 (for parameter) with query 'select empid, empname from employee'

    -- Created a MAIN dataset2 (for report) with query 'select empname, empaddress, sal where empid = @empid'

    -- Now, used dataset1 to fetch values for parameter...with ''Available values'' set to 'Get values from query'..with Value Field as 'empId' and Label field as 'empName'.

    -- Now, to display the selected parameter's label field on the report header, I need to use simple expression -- 'Parameters!empId.Label'.

    -- It displays the correct empname as per the selected empid.

    I think, this should help.. 🙂

    Thanks,

    Niraj

  • Yes, that'll do it. Thanks!

Viewing 8 posts - 1 through 7 (of 7 total)

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