Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Null Value in Listbox
Pujan
The report parameter first displays Null Value, then an empty value and then the actual values from the database.
How to remove the Null Value & Empty value from the report parameter
Find more posts tagged with
Comments
mwilliams
Hi Pujan,<br />
<br />
This post from the devShare may help with that.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/707-removing-nulls-in-combobox-or-listbox-parameters/#description'>Removing
Nulls in ComboBox or ListBox Parameters - Tips & Tricks - BIRT Exchange</a>
fwkeys
This is a tip which I would like to use. I need to get rid of the 'null value' which diplays in the list box. It probably should be clear to me, but I just want to make sure that I'm modifying/replacing the correct code since I don't think my version exactly matches what's in the tip. The code in the ComboBoxParameterFragment.jsp looks like the following. I tried just removing the 'Null Value' everywhere and the text is gone, but the list still has a blank space which can be selected. Can you tell me what else I need to do? Thanks very much.
if ( !parameterBean.isRequired( ) )
{
if( allowMultiValue )
{
if( DataUtil.contain( values, null ) )
{
%>
<OPTION VALUE="" SELECTED >Null Value</OPTION>
<%
}
else
{
%>
<OPTION VALUE="">Null Value</OPTION>
<%
}
}
else
{
%>
<OPTION VALUE="" <%= ( paramValue == null )? "SELECTED" : ""%> >Null Value</OPTION>
<%
}
}
%>
</SELECT>
scowsailor
The instructions in Anthony's Dev Share blog says to remove the space and null text value. Then it posts some "code" which does not resemble anything in my ComboBoxParameterFragment.jsp. I'm at a loss as to what needs to be done to remove these things from my listboxes. The only thing in my jsp that seems like it might have something to do with this is the following:
boolean isSelected = false;
for ( int i = 0; i < parameterBean.getSelectionList( ).size( ); i++ )
{
ParameterSelectionChoice selectionItem =(ParameterSelectionChoice )parameterBean.getSelectionList( ).get( i );
String label = selectionItem.getLabel( );
String value = ( String ) selectionItem.getValue( );
String outputValue = ParameterAccessor.htmlEncode(( value == null)?IBirtConstants.NULL_VALUE:value);
String outputLabel = ParameterAccessor.htmlEncode(( label == null)?IBirtConstants.NULL_VALUE_DISPLAY:label);
if( allowMultiValue )
{
if( DataUtil.contain( values, value, true ) )
{
%>
<OPTION VALUE="<%= outputValue %>"
TITLE="<%= outputLabel %>"
SELECTED><%= outputLabel %></OPTION>
<%
}
else
{
%>
<OPTION VALUE="<%= outputValue %>"
TITLE="<%= outputLabel %>"><%= outputLabel %></OPTION>
<%
}
}
else
{
if ( !isSelected && DataUtil.equals( paramValue, value )
&& ( !isDisplayTextInList || ( isDisplayTextInList && DataUtil.equals(label, displayText ) )))
{
isSelected = true;
%>
<OPTION VALUE="<%= outputValue %>"
TITLE="<%= outputLabel %>"
SELECTED><%= outputLabel %></OPTION>
<%
}
else
{
%>
<OPTION VALUE="<%= outputValue %>"
TITLE="<%= outputLabel %>"><%= outputLabel %></OPTION>
<%
}
}
}
%>
g2kuong
The Syntax Highlighter on the blog is not working properly:
Try this:
if ( !parameterBean.isRequired( ) )
{
if( allowMultiValue )
{
if( DataUtil.contain( values, null, true ) )
{
%>
<option title="">" SELECTED VALUE=""></option>
<option title="">" VALUE=""></option>
<option title="">" VALUE="" ??% : ?SELECTED? )? null paramValue="=" </option>