0

I have a rdl report which has a chart. I would like to set one or zero decimal places depending on a report parameter so I perform the following:

Right Click on the axis chart Report Item -> Properties -> Number -> Custom and I provide below expression:

=IIF(Parameters!vtype.Value=1,"N1","N0")

but in design view, axis labels displays this expression instead of values formatted.

If I set below expression:

=IIF(Parameters!vtype.Value=1,Format(Parameters!vtype.Value, "#,##0.#"),Format(Parameters!vtype.Value, "#,##0"))

I get the same, labels displays with this expression as text.

What am I doing wrong?

Willy
  • 9,848
  • 22
  • 141
  • 284

1 Answers1

2

Right click the Y axis in your chart.

enter image description here

Go to Vertical Axis properties, select Number tab and custom, in custom format textbox use your first expression.

enter image description here

=IIF(Parameters!vtype.Value=1,"N1","N0")

If you select 1 in your parameter it should use "N1" format.

It is normal Visual Studio shows the format expression for the label axis:

enter image description here

At runtime it shows the expected format:

enter image description here

Let me know if this helps.

alejandro zuleta
  • 13,962
  • 3
  • 28
  • 48
  • Yes, this it what I do, but after set first expression and click on accept button in the dialog window, chart shows y values with the text of the expression in design mode. Is it normal that in design mode Y labels are shown with the text of the expression? all y values display as =IIF(Parameters!vtype.Value=1,"N1","N0"). My parameter has a default value. – Willy Sep 01 '16 at 20:15
  • 1
    @user1624552, did you run the report? While designing, VS doesn't know the value or format for the label so it shows the expression. – alejandro zuleta Sep 01 '16 at 20:18
  • Ok, perfect. I had not run the report yet. I didn't know that this behavior was normal in vs design mode for chart. So thanks for confirm me that this is normal in VS design mode. Thanks Alejandro! – Willy Sep 01 '16 at 20:27