Question

The default value for the first item in a drop down list is the name of the database field. I need to change it to a more user friendly name. How do I change the value?

Was it helpful?

Solution

add a HTML Item onto the prompt page and add the following as an HTML item:

Example: <script> document.formWarpRequest._oLstChoicesMyList[0].text = '--SELECT A CITY--'; </script>

Replace 'MyList' with the name of the component.

from: link text

OTHER TIPS

In Cognos 10, you can specify prompt text of your choice in Report Studio.

  1. Select the value prompt
  2. In Properties pane, under 'Prompt Text' section, the 'Header Text' property will be set to Automatic. Click the ellipsis button next to it and Header Text Dialogue opens.
  3. Select 'Specified Text' choice. Click ellipsis.
  4. Provide the text of your choice and click ok.
  5. Run the report and you will see text that you provided will appear as first item in the drop down list.

I have provided a Screen shot for a better understanding.

How to change prompt header text

You have a couple of options. First, you can rename the data item's name from database field name to a more friendly name in the Framework Manager metadata.

Second, you can rename the item in Report Studio. However, if you do this you will notice that it is still using the database name. You actually need to perform a calculation in the item expression for it to use your name instead of the default name. So say you are pulling in the string field [Namespace].[Unfriendly Name] and you named your report data item "Friendly Name." The top selection will still read "Unfriendly Name." However, if you replace the data item with the following:

[Namespace].[Unfriendly Name] || ''

It will see that there is a calculation involved and use your friendly name. In the case of a number field you have to add zero instead of concatenating ''.

This is also the case with report column headers (which you can replace with text instead of using this calculation method).

Convoluted? Yes.

Within the dataitem in the query.. you could do a ..

IF ( [dataitemA] = 'some text' ) THEN ( 'new text' ) ELSE ( [dataitemA] )

i try to avoid using javascript and html items becuase they dont generally work in pdf or excel outputs.

just a thought..

cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top