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

Recent posts

#41
Administration and Security / Re: Leveraging the Cognos Anal...
Last post by MFGF - 30 Oct 2024 02:49:45 PM
Quote from: dougp on 30 Oct 2024 01:51:14 PMI have been trying to leverage the Cognos Analytics REST API from PowerShell and have had some success.  But now I'd like to use it in the context of Cognos Analytics as a JavaScript-based extension.

If I'm logging in directly through the dispatcher (https://servername:9300/), I can run this script to return a list of data modules.

// get base URI from Cognos
const origin = document.location.origin;


// Use this for connecting directly to the dispatcher
//const port = "9300";
const uriBase = origin; //+ ":" + port;

//  // Use this for SSO
//  const port = "9300";
//  const uriBase = origin + ":" + port;


// URI to retrieve all data modules
const uri = uriBase + "/api/v1/modules";

// set the request method
const method = 'GET';

// set the content type
const contentType = "application/json; charset=utf-8";

// inspect the site's cookies to get the XSRF token
const a = document.cookie.split(";");
let b = "";
a.forEach((e) => { if (e.startsWith("XSRF-TOKEN=")) b = e;});
const XSRFTOKEN = b.replace("XSRF-TOKEN=", "");

// set the headers and options for the fetch
const headers = {
'x-xsrf-token': XSRFTOKEN,
accept: 'application/json',
'Cache-Control': 'no-cache',
'Content-Type': contentType
}

const requestOptions = {
method: method,
headers: headers
}

// finally, make the call
let output = await fetch (uri, requestOptions)
.then(response => {
if (!response.ok) {
  throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
return data;
})
.catch(error => {
console.error('Error:', error);
});

console.log(JSON.stringify(output, null, 2));

But if I log in using single sign-on through IIS (https://servername/ibmcognos), and slightly modify my code (see inline comments), it doesn't work.

Access to fetch at 'https://servername:9300/api/v1/modules' from origin 'https://servername' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Thinking that the Cognos Analytics Firewall may help, I added servername and servername:9300 to the list.  No love.

I have also tried setting either header.mode = 'no-cors' or requestOptions.mode = 'no-cors'.

What changes are needed to use the Cognos Analytics REST API while using single sign-on on IIS?



I'm a long way from being an IIS expert, but my suspicion here is that you need to set up an origin host rule in IIS to support your host domain. Probably the easiest way is to set a * origin host rule.

There is some good info in the IIS documentation here:

https://learn.microsoft.com/en-us/iis/extensions/cors-module/cors-module-configuration-reference

I don't use IIS, so it's not something I can test, unfortunately.

Cheers!

MF.
#42
Administration and Security / Leveraging the Cognos Analytic...
Last post by dougp - 30 Oct 2024 01:51:14 PM
I have been trying to leverage the Cognos Analytics REST API from PowerShell and have had some success.  But now I'd like to use it in the context of Cognos Analytics as a JavaScript-based extension.

If I'm logging in directly through the dispatcher (https://servername:9300/), I can run this script to return a list of data modules.

// get base URI from Cognos
const origin = document.location.origin;


// Use this for connecting directly to the dispatcher
//const port = "9300";
const uriBase = origin; //+ ":" + port;

//  // Use this for SSO
//  const port = "9300";
//  const uriBase = origin + ":" + port;


// URI to retrieve all data modules
const uri = uriBase + "/api/v1/modules";

// set the request method
const method = 'GET';

// set the content type
const contentType = "application/json; charset=utf-8";

// inspect the site's cookies to get the XSRF token
const a = document.cookie.split(";");
let b = "";
a.forEach((e) => { if (e.startsWith("XSRF-TOKEN=")) b = e;});
const XSRFTOKEN = b.replace("XSRF-TOKEN=", "");

// set the headers and options for the fetch
const headers = {
'x-xsrf-token': XSRFTOKEN,
accept: 'application/json',
'Cache-Control': 'no-cache',
'Content-Type': contentType
}

const requestOptions = {
method: method,
headers: headers
}

// finally, make the call
let output = await fetch (uri, requestOptions)
.then(response => {
if (!response.ok) {
  throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
return data;
})
.catch(error => {
console.error('Error:', error);
});

console.log(JSON.stringify(output, null, 2));

But if I log in using single sign-on through IIS (https://servername/ibmcognos), and slightly modify my code (see inline comments), it doesn't work.

Access to fetch at 'https://servername:9300/api/v1/modules' from origin 'https://servername' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Thinking that the Cognos Analytics Firewall may help, I added servername and servername:9300 to the list.  No love.

I have also tried setting either header.mode = 'no-cors' or requestOptions.mode = 'no-cors'.

What changes are needed to use the Cognos Analytics REST API while using single sign-on on IIS?

#43
Reporting / Re: Getting PDS-PPE-0104 Erro...
Last post by MFGF - 29 Oct 2024 02:07:49 PM
Quote from: Lokesh Reddy on 29 Oct 2024 10:01:03 AMHi Mark,

Thank You for your response.

Could you please let me know from where we can set the decimal precision to a lower number, whether it can be set on Report settings or Cognos Server or SQL Database?

Thanks,
Lokeswara

What is the source of data in your report? Is it a package that points directly to a database, or is it an OLAP cube of some sort?

If it's a package over a database, you should be able to change the properties of the item in Framework Manager then republish the package - or your Data Module and save it. Or you could just change the properties of the item in your report.

Cheers!

MF.
#44
Reporting / Re: Getting PDS-PPE-0104 Erro...
Last post by Lokesh Reddy - 29 Oct 2024 10:01:03 AM
Hi Mark,

Thank You for your response.

Could you please let me know from where we can set the decimal precision to a lower number, whether it can be set on Report settings or Cognos Server or SQL Database?

Thanks,
Lokeswara
#45
Reporting / Re: Getting PDS-PPE-0104 Erro...
Last post by MFGF - 29 Oct 2024 07:29:37 AM
Quote from: Lokesh Reddy on 28 Oct 2024 11:43:31 PMHi,

We are getting below error on Cognos while running one report in background.

"PDS-PPE-0104 A record was rejected. An arithmetic overflow occurred. -1,379,278,883 DMB-ECB-0070 PPDS Error."

Could you please suggest where and what might be the issue/root cause for this error and how to get rid of this error.

Thanks,
Lokeswara


Hi,

It looks like you have one or more values in your crosstab that exceed the maximum number of digits. I found a support article that covers this:

https://www.ibm.com/support/pages/pds-ppe-0104-record-was-rejected-arithmetic-overflow-occurred-data

Looks like setting the decimal precision to a lower number (eg 2) might get you past the issue.

Cheers!

MF.
#46
Reporting / Getting PDS-PPE-0104 Error
Last post by Lokesh Reddy - 28 Oct 2024 11:43:31 PM
Hi,

We are getting below error on Cognos while running one report in background.

"PDS-PPE-0104 A record was rejected. An arithmetic overflow occurred. -1,379,278,883 DMB-ECB-0070 PPDS Error."

Could you please suggest where and what might be the issue/root cause for this error and how to get rid of this error.

Thanks,
Lokeswara
#47
Reporting / Re: Including Filter values wi...
Last post by dougp - 28 Oct 2024 06:37:59 PM
I have reports that have conditional outputs.  Graphical-only elements like prompt controls render only in HTML, not in PDF or Excel.  So the Excel output could be a clean dataset with the parameter names and values above or below.

If you absolutely need CSV output, be sure your page contains no header or footer and only a single list (that exactly matches the query) with no summarization.  I haven't seen a way to tell Cognos to include arbitrary text before your CSV output (similar to metadata for the first n lines in an open dataset).  It's a little hokey and will take some creativity, but you may be able to fake your parameter names and values into the output by including them in a different query and UNIONing the two.  So, A UNION B = C, then C is the query for your list.  But then your metadata is between your column headers and the data, so it makes the data difficult to consume. 

Basically, use your imagination... and good luck.  Let us know how you solve this.
#48
I loved meeting new people and people I have met on this forum.

I learned that I know a lot more Cognos than I thought.  (After 10 years, I guess I should know a lot.)

I'm excited about the new products (ACH and Ripasso) but I'm concerned about what the price tag may look like.

Regarding next year...  Upgrade to at least 12.0.4, learn about all the new features, and develop a list of wishes and workarounds.
#49
Reporting / Re: Including Filter values wi...
Last post by RunningBear - 28 Oct 2024 04:13:39 PM
Thanks MF.  Followup question . . . I was told that I should try a reporting drop-down with 'Crosstab' or 'list', then when the 'list' is selected, the layout just reflects that and will export out a clean csv file.'

I don't think that is a solution . . . is it?
#50
It was great to meet everyone. 

What did you love?  What did you learn?  What do we need to do to get ready for Orlando next year?