How to auto-submit with cascading prompts
When a series of cascading prompts are all required prompts for a
data container (list, crosstab etc) then that container can't display
anything until all the parameters are populated and submitted. This is
not desirable when the cascading prompts are on the same page as the
data container.
A default value can be specified for the first prompt in the cascade, but since that affects what choices are available for the subsequent prompts defaults for them can not be defined in the same way.
Using Javascript, the subsequent prompts can be set to default to the first value in the filtered list of values. To accomplish this, do the following:
A default value can be specified for the first prompt in the cascade, but since that affects what choices are available for the subsequent prompts defaults for them can not be defined in the same way.
Resolving the problem
Note: This technique uses JavaScript against underlying report objects in a Cognos BI report. For this reason, there is no guarantee that reports created using this technique will migrate or upgrade successfully to future versions without requiring modifications. Any such modifications are the responsibility of the report designer.Using Javascript, the subsequent prompts can be set to default to the first value in the filtered list of values. To accomplish this, do the following:
- Set up the series of cascading prompts as needed
- Set the name property of each prompt (_CascPrompt1, _CascPropmt2 ..._CascPromptN)
- Set the Default Value property for the first prompt.
- Set the Auto-Submit property to all the prompts to Yes
- Beside the subsequent prompts, place an HTML item
- Put the following code into the HTML item (be sure to use the correct prompt name)
- <script language="javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}
var list = fW._oLstChoices_CascPromptN;
list.remove(1);
list.remove(0);
list.removeAttribute("hasLabel");
var ptype = list.options[0].value ;
</script>
Comments
Post a Comment