PDA

View Full Version : '-' in item band



Anonymous
09-19-2002, 09:52 AM
All the null values in the database are appearing as "-" in my report. How do I get rid of this? If the value is null in the database , I do not want any character appearing in my report. If I must have a character , I prefer to show " " than "-". How can I do this?


Thanks.

Anonymous
09-19-2002, 11:46 AM
add the attribute nullstring="",

ex.

<string-field name="Tag1" x="100" y="0" width="66" height="8" alignment="right" fieldname="tag1" nullstring=""/>

David Croley

Anonymous
09-19-2002, 01:23 PM
Thank You - this worked.

Anonymous
09-26-2002, 11:59 PM
The attribute worked for string-field,but not for number-filed.

<number-field name="amount1" x="400" y="1" width="69" height="8" alignment="right" format="#,##0.00" fieldname="amt" nullstring="" />

I defined a number-filed as that.But it does not work.

What should I do?

Anonymous
10-07-2002, 08:50 PM
who can help me??

Anonymous
10-08-2002, 10:22 AM
Hi tsingt,

sorry, you caught me in my short off-line time. And you found a bug: Neither Date nor Number fields and functions have this functionality. They should, but it got lost during a rewrite in August ... but no one had noticed yet.

Bug-Description:
NullStrings are attached on the filter level, so if a Formating filter finds a null-value, the 'null' is replaced by the NullValue defined for the filter. The TextElement uses an private "StringFilter" to format the value from the field/function into a String. This private filter is initialized using the XML-Attribute and the ItemFactory. But the special conversion of Dates and Numbers into a String is done by a previous filter, which produces a String (the Date~ and NumberFormatFilter). The result of those filters is then fed into the textelement and applied to the private StringFilter to make finally sure that a string is available.

The FormatFilter implementation also defines a NullValue, which is set to "-". This definition is never changed, the ItemFactory changes the private StringFilter. So if your field or function contains null, the null-value is replaced by "-" and then fed into the TextElements private filter. This filter finds a non-null value and proceeds without applying your XML-Defined NullString.

To fix this, simply remove the initialisation of the NullValue in the class FormatFilter. The source should be changed to:

/**
* Default constructor.
*/
public FormatFilter ()
{
// old - remove or comment out: nullvalue = "-";
nullvalue = null;
}

I will also apply this to the cvs.

Have more fun,
said Thomas

Anonymous
10-09-2002, 03:16 AM
Hi,Thomas

Thanks.
It works for me:)
but I write the function as this: