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

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Javascript Function to Pass Variables from Prompt Page to Database

Started by sundet, 28 Oct 2014 04:01:00 PM

Previous topic - Next topic

sundet

Good afternoon,

I'm working with a prompt page.  I'd like to learn how Cognos passes variables to the database from the prompt page.  My experience with the data prompt is that if the value in it is changed programmatically via Javascript, the resulting report is still based on the old value in the date prompt.

Help in this regard would be much appreciated. 

MFGF

Quote from: sundet on 28 Oct 2014 04:01:00 PM
Good afternoon,

I'm working with a prompt page.  I'd like to learn how Cognos passes variables to the database from the prompt page.  My experience with the data prompt is that if the value in it is changed programmatically via Javascript, the resulting report is still based on the old value in the date prompt.

Help in this regard would be much appreciated.

It really depends on where and how the prompted-for parameters are being used in the report. If they are used in detail filters, then the parameters are resolved into real values by means of prompting, and passed to the database as predicates in the generated queries. If they are used in summary filters, generally they will be involved in local processing on the Cognos server.

Cheers!

MF.
Meep!

sundet

I should probably get a deeper understanding about how choices in a web page are communicated to the server.  What methods are used for Cognos?  I have heard of JSON.  Is this what I should study?  Is there something else I should study?

MFGF

Quote from: sundet on 31 Oct 2014 11:58:44 AM
I should probably get a deeper understanding about how choices in a web page are communicated to the server.  What methods are used for Cognos?  I have heard of JSON.  Is this what I should study?  Is there something else I should study?

What is the issue you are trying to solve? Knowledge of JSON isn't really going to help you here, unless you plan on using Mashup Service or the SDK.

Choices you make in a web page are generally passed in via prompt parameters in a report. The way in which these are utilised depends on how you designed the report. The whole idea really is that you don't need to worry about creating SQL or MDX queries and figuring out how to inject code - the UI allows you to build a report where all of this is taken care of for you. What is it you are looking to achieve?

MF.
Meep!

sundet

I was wrong about the values in the prompt not being used to obtain report data.  The value that is put into a date box via Javascript is used to obtain report data.  I created the report from scratch and things worked.

I'd like to have multiple optional criteria on a prompt page.  I'd like to control whether the criteria is required via a radio button.  Is there a way to access properties of a control via JavaScript?  I was thinking that the Javascript could set the control to inactive and the required property to no when the value of the radio button is false.  Is this possible?  Is it possible for Cognos to ignore the value in the prompt control? 


MFGF

Quote from: sundet on 04 Nov 2014 09:22:21 AM
I was wrong about the values in the prompt not being used to obtain report data.  The value that is put into a date box via Javascript is used to obtain report data.  I created the report from scratch and things worked.

I'd like to have multiple optional criteria on a prompt page.  I'd like to control whether the criteria is required via a radio button.  Is there a way to access properties of a control via JavaScript?  I was thinking that the Javascript could set the control to inactive and the required property to no when the value of the radio button is false.  Is this possible?  Is it possible for Cognos to ignore the value in the prompt control?

What version of Cognos are you using? ReportNet? Cognos 8? Cognos 10? There were some major changes made to the way javascript can be used between these versions.

MF.
Meep!

sundet


MFGF

Quote from: sundet on 05 Nov 2014 12:36:57 PM
I am using the Report Studio in Congnos 10.1.1.

10.1.1? So this is posted in the wrong section, then. I will move this post from the ReportNet section to the Cognos 10 section...

MF.
Meep!

AM

Quote from: sundet on 04 Nov 2014 09:22:21 AM
I was wrong about the values in the prompt not being used to obtain report data.  The value that is put into a date box via Javascript is used to obtain report data.  I created the report from scratch and things worked.
Whatever is in the prompt will be used by the report. If you manipulate the prompt value with javascript on the prompt page then submit, this is what ends up going to the main report page. You can do some troubleshooting using the report layout components to show what has been passed to the report.

Quote from: sundet on 04 Nov 2014 09:22:21 AMI'd like to have multiple optional criteria on a prompt page.  I'd like to control whether the criteria is required via a radio button.  Is there a way to access properties of a control via JavaScript? 
Cognos 10.2 came with a Prompt API that is reasonably well documented. Since you're using 10.1.1 you'll need to use less rigid javascript - search as there are plenty of examples out there.

Quote from: sundet on 04 Nov 2014 09:22:21 AMI was thinking that the Javascript could set the control to inactive and the required property to no when the value of the radio button is false.  Is this possible?  Is it possible for Cognos to ignore the value in the prompt control?
Pretty much anything is possible with javascript, but slot in some time to re-write it when you upgrade BI.