SSRS 2008 R2 returns "#ERROR" when exporting to PDF
I am attempting to parse a string that contains a device's make, model,
and serial number into separate fields to end up in their own column in
the report. The source value would generally be something like
"3B0645X01543 APCBack-UPS ES 550 FW:840.B2.D USB FW:B2" where the first
set of characters is the serial number, APC is the make, and "Back-UPS ES
550" is the model. My goal is to have my report return a value of "APC"
for make, the number value after ES for model, and the first character set
for serial number. I have this working as long as I render directly to
HTML. If I render to PDF, Excel, or anything else each of these columns
return "#Error". Here is how I'm doing it.
The source is a field in the same data set named "DeviceID". For the
example, it contains the string "3B0645X01543 APCBack-UPS ES 550
FW:840.B2.D USB FW:B2".
I have 3 calculated fields in my dataset, Make, Model, and Serial. The
expression for Make is below.
=SWITCH(Fields!DeviceID.Value.ToString().Contains("EATON"), "Eaton",
Fields!DeviceID.Value.ToString().Contains("APC"), "APC",
Fields!DeviceID.Value.ToString().Contains("Tripp"), "TrippLite",
Fields!DeviceID.Value.ToString().Contains("American"), "APC")
I am then using a lookup function to pull this "Make" field into the table
in my report.
Again, if I render to HTML all three values work like a champ. Any other
render gets me "#Error". Any help is GREATLY appreciated!
No comments:
Post a Comment