If you are unable to create a new account, please email support@bspsoftware.com

 

Dynamically update text item from user selected value prompt - on the same page

Started by Jana18, 26 Sep 2012 10:12:04 AM

Previous topic - Next topic

Jana18

Hi,

I am new to Cognos, and it might be the case that what I am attempting is not possible, but my case is simple.

I have prompt page, with two items:

- Value prompt - has some static choice values defined, has a parameter name set to "Parameter3"
- Text item - source type is set to "Report Expression", with the report expression being "ParamValue('Parameter3')"

What I expect to happen when running this report is for the text in the text item to change dynamically when selecting different values in the value prompt, with the text content being refreshed each time a different value is selected.  However this is not the case, and nothing happens when I select any value in the value prompt.

Is what I am attempting even possible?  I am from a programming background so I may have wrongly assumed it possible.

Many Thanks

Bindiya


Jana18

Thanks Diya, however that does not appear to work, also I do not want to submit straight after a value prompt change.  To further test this I added a blank text prompt that has as value set to "Yes" for the required property, so when I change the value prompt I get a message stating "One or more of the required values is missing", even with this in place to stop it going to the next page I can see that the text item is still blank and not populated with the value of the selected value prompt.

Any help with this would be greatly appreciated.

Thanks

Bindiya

This is what I tried and it works fine.

Prompt page:
Value prompt - Autosubmit:Yes
Text Item - Displays selected option in value prompt
Value prompt - Cascade: First value prompt (to stop prompt page from submitting immediately on changing option in first value prompt) - Required:no (otherwise prompt page will never get submitted). This is a dummy prompt and can be of any type (text box or drop down)
By submitting I mean displaying report page.
Report page:
Text Item - Displays selected option in value prompt

Sample report XML
<report xmlns="http://developer.cognos.com/schemas/report/8.0/" useStyleVersion="10" expressionLocale="en-us">
<modelPath>/content/folder[@name='Samples']/folder[@name='Models']/package[@name='GO Sales (analysis)']/model[@name='model']</modelPath>
<drillBehavior modelBasedDrillThru="true"/>
<layouts>
<layout>
<reportPages>
<page name="Page1">
<style>
<defaultStyles>
<defaultStyle refStyle="pg"/>
</defaultStyles>
</style>
<pageBody>
<style>
<defaultStyles>
<defaultStyle refStyle="pb"/>
</defaultStyles>
</style>
<contents><textItem><dataSource><reportExpression>ParamDisplayValue('Parameter1')</reportExpression></dataSource></textItem></contents>
</pageBody>
</page>
</reportPages>
<promptPages><page name="Prompt Page1">
<pageHeader>
<contents>
<block>
<contents>
<textItem>
<dataSource>
<staticValue/>
</dataSource>
<style>
<defaultStyles>
<defaultStyle refStyle="tt"/>
</defaultStyles>
</style>
</textItem>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="ta"/>
</defaultStyles>
</style>
</block>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="hp"/>
</defaultStyles>
</style>
</pageHeader>
<pageBody>
<contents><selectValue autoSubmit="true" parameter="Parameter1"><selectOptions><selectOption useValue="1"><displayValue>One</displayValue></selectOption><selectOption useValue="2"><displayValue>Two</displayValue></selectOption></selectOptions></selectValue><textItem><dataSource><reportExpression>ParamDisplayValue('Parameter1')</reportExpression></dataSource></textItem><selectValue parameter="Dummy" cascadeOn="Parameter1" required="false"><style><CSS value="visibility:hidden"/></style></selectValue></contents>
<style>
<defaultStyles>
<defaultStyle refStyle="py"/>
</defaultStyles>
</style>
</pageBody>
<pageFooter>
<contents>
<promptButton type="cancel">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>


<promptButton type="finish">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="fp"/>
</defaultStyles>
</style>
</pageFooter>
<style>
<defaultStyles>
<defaultStyle refStyle="pp"/>
</defaultStyles>
</style>
</page></promptPages></layout>
</layouts>
<XMLAttributes><XMLAttribute name="RS_CreateExtendedDataItems" value="true" output="no"/><XMLAttribute name="listSeparator" value="," output="no"/><XMLAttribute name="RS_modelModificationTime" value="2011-06-09T13:51:23.483Z" output="no"/></XMLAttributes></report>

Jana18

Thank you very much Diya, your example code worked fine.  I was missing the dummy prompt, however I would like to gain a better understanding of why it only works with a dummy prompt with cascade set?  If I use dummy prompt with a Required:Yes, why would this not update the text item prompt?

Thanks again for your help.

Jana18

Also another question related to your example, how do I view the hidden prompt you created within Report Studio?

Thanks

RKMI

Hi Jana,

To View Hidden Object in RS, on the toolbar click View - Visual Aids - Show Hidden Objects.

Thanks,
RK

Bindiya

If cascade property was not set to the dummy prompt, then report would get submitted as soon as an option is selected from value prompt.
By setting this cascade property, Cognos would realize that this dummy prompt is dependent on the value prompt and hence would wait.

If we set this dummy prompt as required, then 'Finish' button will be disabled and will not be enabled unless a value is provided.