Sitemap
Abpgupta

Abpgupta

Cognos Tips

How to select first value in Value (ListBox) Prompt using JavaScript?

Jul 13, 2021

--

  1. Change report property to have Interactive = No (to run in classic mode)
  2. Add ListBox Prompt and name it to Prompt1
  3. Add HTML item after it
  4. Add below Script inside HTML content

<script language=”javascript”>
var f = getFormWarpRequest();
var list = f._oLstChoicesPrompt1;
list.options[1].selected = true;

canSubmitPrompt();
</script>

How to get Session User Name in Report?

Get Abpgupta’s stories in your inbox

Join Medium for free to get updates from this writer.

Use below expression in Data item in report to get name:-

#sq($account.defaultName)#

How to pass optional Parameters in Native SQL?

Add default no selection condition to query where clause:-

(
(<Operation> = #prompt(‘pOperNumber’, ‘string’,sq(‘Not Selected’))#)
or
((‘Not Selected’) = (#prompt(‘pOperNumber’, ‘string’, sq(‘Not Selected’))#))

)

How to default dates with Prompt Macro?

[Date] BETWEEN (

#prompt(‘pAccDtFrom’,’date’, ‘(_first_of_month (_add_months(current_date, — (_month(_add_months(current_date,-1))) )))’)#)

and

(#prompt(‘pAccDtTo’,’date’, ‘(_last_of_month (_add_months(current_date,-1)))’)#)

--

--