Choose Logo from drop down

  • Hi,

    I have a report with parameters FirmID and Logo . Logo parameter has values : Logo 1 and Logo 2, Logo 3 .. in the drop down list.

    When FirmID = 1 then Logo 1 should be selected by default , When FirmID <> 1 then Logo 2 should be selected during the first report run .

    Users should also have the ability to change the report logo .

    When FirmID = 1, users should manually be able to change the logo to 'Logo2' instead of default 'Logo1'.

    When FirmID <> 1, users should manually be able to change the logo to 'Logo1' instead of default 'Logo2'.

    Please help .

    Thanks,

    PSB

  • Firstly - make sure the two images have been added to the report (they should appear in the Images folder of Report Builder). Then, put this into the "Use This Image" field of the Image Properties window (right-click on the Image and select Properties) of the Image item you've added to the report:

    =IIF(Parameters!FirmID.Value = 1, Image1, Image2)

    The above means "If FirmID parameter = 1, then show Image 1, else show Image 2".

  • I am already this expression in the 'Use this image' text box and it works correctly in the default run .

    =IIF(First(Fields!FirmID.Value, "dsDataset1") = 1, "Logo1", "Logo2") .

    The users should be also able to change the logo after the initial run .. i.e

    If FirmID = 1 , they should be able to select Logo1,2,3,4.. from the dropdown according to their choice OR

    If FirmID <> 1 , they should be able to select Logo1,2,3,4.. from the dropdown according to their choice from the dropdown

    Thanks,

    PSB

  • Unless there's reason behind the code you've used, for readability I would change

    =IIF(First(Fields!FirmID.Value, "dsDataset1") = 1, "Logo1", "Logo2") .

    to

    Parameters!FirmID.Value

    To answer your question, I suggest adding another parameter for selecting the logo image to use. Use the available values property to do the logo filtering.

    You'll need to write a query that does your logic, something like:

    SELECT 'Logo1' as IMAGENAME, 'Logo option 1' as LABEL WHERE @FirmID in (1,2,3)

    UNION ALL SELECT 'Logo2' as IMAGENAME, 'Logo option 2' WHERE @FirmID in (2)

    UNION ALL SELECT 'Logo3' as IMAGENAME, 'Logo option 3' WHERE @FirmID in (3)

    UNION ALL SELECT 'Logo4' as IMAGENAME, 'Logo option 4' WHERE @FirmID in (3)

    Where "FirmID" is your the name of your FirmID report parameter, and the WHERE @FirmID in being whatever filtering logic you're using to filter the list of logos each company can use.

    Under parameter properties set "Available Values" to "Get values from a query", set "Dataset:" to be the query you've added above, "Value field:" to be "IMAGENAME" and "Label field:" to be "LABEL".

    That would give you a drop-down to select the logo, with the list of logos available dependent on the value selected in the firm parameter. To set the default value, you'd need to use the "Default Values" property for the new parameter to specify a query that retrieves the default logo for a specified @FirmID.

  • Do you want the logo to be controlled by the first row of the dataset, or by the users selecting the value from a dropdown?

    This: =IIF(First(Fields!FirmID.Value, "dsDataset1") = 1, "Logo1", "Logo2")

    Isn't the same as this: =IIF(Parameters!FirmID.Value = 1, Image1, Image2)

    If you want users to be able to control the logo in the report, you need to add a parameter to the report that has available values of 1 and 2, with a default value of 1 (specified by you, and not a dataset), and then they can change the value after the report is first run. Not a dataset, because you can't always be guaranteed of the order of the rows returned, and you might always have a value of 1 returned for your IIF function.

    This is based on you saying "The users should be also able to change the logo after the initial run .. i.e". So a user controlled parameter is the only option for this.

Viewing 5 posts - 1 through 4 (of 4 total)

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