Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Setting a default parameter value from a dataset value
Setting a default parameter value from a dataset value [message #753785] Fri, 28 October 2011 17:54 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Hi,

I have a cascading parameter list as follows:
Id (bound to Get All Subscriptions dataset)
Start Time (bound to Get Start Times dataset)
End Time (bound to Get End Times dataset)

When the user selects an Id the Start Time parameter is filled by executing the Get Start Times query.

I would like to select the first row from the list of Start Times as the default value of the list and subsequently the same for End Time.

The GUI only lets you specify a constant value for the default value and I'm clueless as to how to access the dataset values from the available script exits for the parameter.

I would much appreciate if someone could show me how this could be done.

Thanks
Mike
Re: Setting a default parameter value from a dataset value [message #753807 is a reply to message #753785] Fri, 28 October 2011 20:17 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike

I do not know of an easy way of doing this. I assume you have an issue
with the blank option that is displayed instead of the first result? If
so you could modify the parameter dialog fragment to ignore the blank entry.

Jason

On 10/28/2011 1:54 PM, Mike Wulkan wrote:
> Hi,
>
> I have a cascading parameter list as follows:
> Id (bound to Get All Subscriptions dataset)
> Start Time (bound to Get Start Times dataset)
> End Time (bound to Get End Times dataset)
>
> When the user selects an Id the Start Time parameter is filled by
> executing the Get Start Times query.
> I would like to select the first row from the list of Start Times as the
> default value of the list and subsequently the same for End Time.
> The GUI only lets you specify a constant value for the default value and
> I'm clueless as to how to access the dataset values from the available
> script exits for the parameter.
>
> I would much appreciate if someone could show me how this could be done.
>
> Thanks
> Mike
Re: Setting a default parameter value from a dataset value [message #754004 is a reply to message #753807] Mon, 31 October 2011 12:03 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Thanks Jason, simply ignoring the blank entry would work for me but I'm not sure how to do that? When I uncheck the "required parameter" setting, the blank is replaced by the string "null" and the dialogue won't dismiss without choosing a value from the list. Fyi, the parameter is a date field if that makes a difference. I really just want the first item in the list to be the default value; ideally I'd like it to show up in the dialogue, but blank would also suffice. I assume that if I could figure out the blank issue, I'd have to have the report code test the parameter for blank and replace it with an equivalent query to get the first value from the dataset?
Re: Setting a default parameter value from a dataset value [message #754028 is a reply to message #754004] Mon, 31 October 2011 14:37 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Look at the ComboBoxParameterFragment.jsp.
Try changing this

if ( parameterBean.getSelectionList( ) != null )
{
if( !parameterBean.isRequired( ) || ( parameterBean.isCascade( ) &&
DataUtil.trimString( defaultValue ).length( )<=0 ) )
{
if( allowMultiValue && DataUtil.contain( values, "", true ) )
{
%>
<OPTION SELECTED></OPTION>
<%
}
else
{
%>
<OPTION></OPTION>
<%
}
}

if ( DataUtil.trimString( defaultValue ).length( ) > 0 &&
!parameterBean.isDefaultValueInList( ) ) // Add default value in Combo Box


to




if ( parameterBean.getSelectionList( ) != null )
{


if ( DataUtil.trimString( defaultValue ).length( ) > 0 &&
!parameterBean.isDefaultValueInList( ) ) // Add default value in Combo Box

Jason

On 10/31/2011 8:03 AM, Mike Wulkan wrote:
> Thanks Jason, simply ignoring the blank entry would work for me but I'm
> not sure how to do that? When I uncheck the "required parameter"
> setting, the blank is replaced by the string "null" and the dialogue
> won't dismiss without choosing a value from the list. Fyi, the parameter
> is a date field if that makes a difference. I really just want the first
> item in the list to be the default value; ideally I'd like it to show up
> in the dialogue, but blank would also suffice. I assume that if I could
> figure out the blank issue, I'd have to have the report code test the
> parameter for blank and replace it with an equivalent query to get the
> first value from the dataset?
Previous Topic:excel emitter: show output without excel (on linux)
Next Topic:Dynamically sort a crosstable at render time
Goto Forum:
  


Current Time: Thu Apr 25 11:54:07 GMT 2024

Powered by FUDForum. Page generated in 0.03054 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top