Question

I'd like to pass the value of a parameter if it contains certain word in the value field and I have this query:

="[Orders].[PrevMonth].&["
& switch(
Parameters!OrdenesMes.Value = "%Enero %","Enero",
Parameters!OrdenesMes.Value = "%Febrero %","Febrero",
Parameters!OrdenesMes.Value = "%Marzo %","Marzo",
Parameters!OrdenesMes.Value = "%Abril %","Abril",
Parameters!OrdenesMes.Value = "%Mayo %","Mayo",
Parameters!OrdenesMes.Value = "%Junio %","Junio",
Parameters!OrdenesMes.Value = "%Julio %","Julio",
Parameters!OrdenesMes.Value = "%Agosto %","Agosto",
Parameters!OrdenesMes.Value = "%Septiembre %","Septiembre",
Parameters!OrdenesMes.Value = "%Octubre %","Octubre",
Parameters!OrdenesMes.Value = "%Noviembre %","Noviembre",
Parameters!OrdenesMes.Value = "%Diciembre %","Diciembre")
&" "
& year(now) 
&"]"

but seems not to work properly or doesn't pass the correct value, any ideas on how I can solve this?

An error has occurred during report processing. (rsProcessingAborted)
The Value expression for the query parameter ‘OrdenesMesFin’ contains an error: The expression referenced a non-existing parameter in the report parameters collection. (rsRuntimeErrorInExpression)
Was it helpful?

Solution

Your error message is pointing at an issue with a parameter reference - I would check the OrdenesMes parameter exists. The name is case-sensitive.

After that, to achieve what you want, I would replace each = with Like, and each % with *, e.g.

Parameters!OrdenesMes.Value Like "*Enero *","Enero",

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top