COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: jesse.p on 20 Feb 2018 08:28:08 AM

Title: str([Amount]) returns a 1 in all cases when accessing data item directly
Post by: jesse.p on 20 Feb 2018 08:28:08 AM
If I create a query calc field defined as str([Sales].[Amount]) the report output gives a value of 1, regardless of actual value stored in [Sales].[Amount].

If I add [Sales].[Amount] to my Query, then create my query calc defined as str([Amount]) it correctly converts my decimal into a string.

Why do I have to add the field to the Query first and create a placeholder field?  Should I be able to access the field directly in my first example?

Edit: Cognos 10.2.2 talking to MS SQL source.
Title: Re: str([Amount]) returns a 1 in all cases when accessing data item directly
Post by: MFGF on 20 Feb 2018 09:06:38 AM
Quote from: jesse.p on 20 Feb 2018 08:28:08 AM
If I create a query calc field defined as str([Sales].[Amount]) the report output gives a value of 1, regardless of actual value stored in [Sales].[Amount].

If I add [Sales].[Amount] to my Query, then create my query calc defined as str([Amount]) it correctly converts my decimal into a string.

Why do I have to add the field to the Query first and create a placeholder field?  Should I be able to access the field directly in my first example?

Edit: Cognos 10.2.2 talking to MS SQL source.

What is the Aggregate Function property for the calculated item set to be? Automatic? What do you see if you set it to be 'None'? My guess is the report is originally trying to aggregate your calculated item by counting it :)

MF.
Title: Re: str([Amount]) returns a 1 in all cases when accessing data item directly
Post by: jesse.p on 20 Feb 2018 03:24:24 PM
Quote from: MFGF on 20 Feb 2018 09:06:38 AM
What is the Aggregate Function property for the calculated item set to be? Automatic? What do you see if you set it to be 'None'? My guess is the report is originally trying to aggregate your calculated item by counting it :)

Spot on.  Thank you.

Is this something set in the Framework Model?
Title: Re: str([Amount]) returns a 1 in all cases when accessing data item directly
Post by: jesse.p on 20 Feb 2018 04:09:22 PM
I understand what I did wrong.

I started by dragging in a field from the data source, then started modifying it.  It carried with it all the properties of the field from the model.

I should have started with a new query calc from scratch.