Conditional parameter default

  • My report has a dataset named Chain, this provides a list of chains (sub-companies) for the client running the report. It is populated using a client ID passed into the report as a parameter. The dataset may contain 1 or multiple chains.

    I have a parameter for Chain. It gets its value list from the Chain dataset (this part is working OK).

    I need to set a conditional default, so that if the Chain dataset contains a single chain, this chain becomes the default (completing all necessary parameters & allowing the report to autorun).

    If the Chain dataset has more than 1 chain, I need to NOT choose a default. This forces the client to choose their chain(s) for the report before they run it.

    I think I'm on the right idea with an expression testing Parameters!ChainID.Count, like

    IIF(Parameters!ChainID.Count=1,Parameters!ChainID.Value(0),?????)

    When I try to set the default to Parameters!ChainID.Value(0), the report fails with message "An error occurred during local report processing".

    Also, on the Else part of IIF what would I use to have no default?

  • TO the second question, I believe the answer you're looking for is ...

    =Join(Parameters!ChainID.Value,",")

    This gets you to a point where you have ="Chain1,Chain2,Chain3"

    You need to get to ="Chain1","Chain2","Chain3" if you're trying to pass multiple values into a sproc or query. There are functions and other ways to split the parameters in this way.

  • The requirement on this is when there's only 1 chain, select it as the default and let the report auto-run. Otherwise (multiple chains exist), select nothing as the default & force the user to choose their chain(s).

    As I'm reading it, Join would be useful if I'm trying to set the default to "all chains". Unless this pulls all currently selected chains in the list, which since the default hasn't been set yet, equals no chains?

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

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