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

How to feed variable data to column?

Started by hommer, 10 Sep 2010 01:29:53 PM

Previous topic - Next topic

hommer

Hi, all,

In the report studio, how do I make a column's data fed from a variable?

I have created myVar = ltrim([rpt].[view].[field1], '0').

The reason I cannot directly use ltrim on the column is that I have to feed field1 as input parameter to a custom function, which is expecting native data (with all the leading zeros).

Thanks!

ksvchowdary

I am not sure what you are trying to get.Here is the exact syntax of Ltrim.

ltrim
Returns string_exp with leading spaces removed.
Syntax
ltrim ( string_exp )

Ex: ltrim(field1)
it returns only leading leading spaces removed.If you dont need zeros ( 0 's ) use left or right function.

ex: you have a number like  00012345 , you need only 12345.you can use right(00012345,5).but make sure leading zeros have same fixed width in all values.

hommer

#2
Thank you for your reply.

My trim part is working. That serves my column one need.

However I have another column two on the report and its data will come from a function on the database. That function needs an input parameter, which is the same field as column one but without the trimming part.

What is why I tried to asign the trimmed data to a local variable then feed to col one, and feed the untrimmed same field to my function to get the data for col two.

On the expression for col one, it wouldn't take myVar or =myVar as valid entry.

Maybe using a variable is not the right solution.

Then, again, when I tried to bring in the same field 2nd time, one with trim and one without. It didn't like that either. Cognos will make them same. ???

hommer

Ok, case closed.

Query calculation did it.