I have two fields I want to compare in CR 2008. If the fields are different, I want them both to be red; if they're the same, they're both black. I have done this many times with "standard" fields in CR and the conditional formatting works fine.
Now, my problem.
I have a table in VS 2008 that drives the CR report. The contents of each of the two fields to be displayed contain text or numeric data. If the record is text, I leave it alone. If the record is numeric, I replace the record with RTF formatting to align the decimal point ("\lixxx") so when the report is run, all the decimal points line up (rather than being displayed with a ragged right side - simulating a decimal tab). Both fields in CR are set for RTF text interpretation. When the report is run, the fields are formatted exactly how I want them.
(Note: In this report, I cannot use right flush in the field because the field is quite wide to allow room for the text, and I want the numeric values to be as close to the left side of the field as possible.)
The problem is, only those fields with text (no RTF formatting) are compared correctly - those that are different are highlighted in red. The numeric fields (with RTF formatting) don't compare correctly - the differences are not highlighted.
The records with text contain only the text (no RTF headers or formatting); the records with numbers contain the RTF header, formatting information, and the value. If I shut off RTF text interpretation for these fields, the RTF format strings are compared correctly.
Here's what I am sending to CR for numeric values:
"{\rtf1\ansi\deff0 {\fonttbl{\f0 Arial;}}" & str_RTF_Indent & " \fs16 " & sng_RTF_Value, where:
'sng_RTF_Indent' is the left indent I need to align the decimals ("\lixxx", where xxx is the number of twips to indent)
'str_RTF_Value' is the text string of the number to be displayed.
Here's the formula I have in both fields to compare the two fields:
if {Catalog_Table_Report.Value 1} <> totext{Catalog_Table_Report.Value 2} then
formula = crRed
end if
The numeric alignment works perfect, I just can't compare the two fields when Text Interpretation is set to RTF.
If I create a formula field in CR for testing purposes only:
{Catalog_Table_Report.Value 1} = {Catalog_Table_Report.Value 2}
The field correctly reports true or false depending on whether Value 1 and Value 2 are equal.
Does CR not compare fields when they are RTF formatted, or is there something I'm missing?
Thank you in advance for your help!
Edited by CIW George - 05 Apr 2010 at 6:29am