Replacing 0 (zero) with - (dash) in the detail area of an active report


02-04-2010, 7:24 AM
I need to deliver a report that shows numeric values provided by bound columns. Is is possible to replace any column value = 0 with a dash. The bound column data source is type integer.

My preferred method would be manipulation of a calculated field via a formula.

Re: Replacing 0 (zero) with - (dash) in the detail area of an active report


02-04-2010, 9:57 PM
Hello,

You can always check the value of a field in the fetch data event and change the fields value. To change the field value from zero to dash you can use this in fetch data event:
             //C#
             if ((int)Fields["Number"].Value == 0)
            {
                Fields["Number"].Value = "-";
            }


Please do let me know if I misunderstood the issue.

Regards,
Subodh

Re: Replacing 0 (zero) with - (dash) in the detail area of an active report


02-11-2010, 10:53 AM
Subohh, thanks for the initial response, but I had already tried something similar within the rpx file, because the c# file is using a datareader that is supposed to be hands off. I was hoping to leverage the formula functionality in a calculated column to achieve this result.

I was concerned that conversion of the value within a SQL Select statement of otherwise would negatively impact my ability to perform mathmatical (sum) functions dynamically within the active report.

Re: Replacing 0 (zero) with - (dash) in the detail area of an active report


02-12-2010, 4:52 AM
Hello,

You can use the ternary operator in the DataField expression for checking the zero value.
For Example

textBox1.DataField = “= (Value == 0) ? "-" : Value”;

To know more about DataField expression you may click here.

I hope it helps.

Regards,
Ankit Nigam