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

 

str([Amount]) returns a 1 in all cases when accessing data item directly

Started by jesse.p, 20 Feb 2018 08:28:08 AM

Previous topic - Next topic

jesse.p

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.

MFGF

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.
Meep!

jesse.p

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?

jesse.p

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.