Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a matrix with dynamic parameters operating the rows, columns and data field of the matrix. The 4th one will apply a chosen aggregate function to the data field. The values of the data parameter are called
SQL
LengthOfStay
and
SQL
FinalCost


Depending on which of the two values the user selects when running the report, I want the report to format the number type according to which value has been selected. LengthOfStay should appear on the report as integers, preferably with a thousand separator. FinalCost should appear on the report as currency (GBP in this case.)

I've tried doing this in the Number Format property of the data field textbox;

C#
=SWITCH
	(Parameters!prmDataField.Value=Fields!Length_of_Stay.Value,"G0"
	,Parameters!prmDataField.Value=Fields!Spell_Final_Cost.Value,"C0")


But when the report runs the numbers in it are not formatted and the following warning is given below;

Warning	1	[rsRuntimeErrorInExpression] The Format expression for the textrun ‘Textbox17.Paragraphs[0].TextRuns[0]’ contains an error: Input string was not in a correct format'


I have absolutely no idea how to syntax this and if it's even possible. I'm still getting used to expressions but applying them to formatting where number types are concerned seems to be even more complex!

Thanks for anyone taking the time to understand and help :)
Posted
Updated 11-Feb-15 3:32am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900