Switch statement in SSRS help

Hi

I have address fields on the RMA report as standard. It uses the Invoice address of the customer.

We want to display the Ship to Addresses if the ShiptoNum on RMADtl has a value.

I have done the pre req work to add the relationship to Shipto stable in the data definition and I have added to the dataset on the ssrs report.

I want to now add switch statements the existing invoice address fields to say if ShiptoNum = blank then display, if not blank then display new field. However im getting a too many functions error:

image

image

Please can anyone help me ?

I have got it working now when ShiptoNum has a value- however when it does not have a value and so we want it to use the standard logic the report runs and shows error

image

image

I think .value on a NULL field will throw an error.

When ShipToNum doesn’t have a value, do you mean that it is passed as 0 or is it null?

If ShipToNum always has at least some placeholder value (like 0), which may be the case looking at your switch statement, the problem probably lies in your SplitFun code.

If it’s null, I would try using just an iif statement with an isnothing as the condition:
=iif(isnothing(Fields!ShipToNum.Value),TRUE STUFF, FALSE STUFF)

1 Like

Report Builder’s editing capabilities are truly horrendous. I find it helpful to write your code in Notepad++, selecting the language to get nice syntax highlighting, and then paste it into Report Builder when you’re done. You’ll spot many errors this way.

Your error screenshot says it’s the Visibility.Hidden expression. This check has to return TRUE or FALSE. You’re returning an address line into an expression that isn’t expecting it.

1 Like