COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: cham on 19 Sep 2011 12:36:41 PM

Title: passing values in lastPeriod()
Post by: cham on 19 Sep 2011 12:36:41 PM
Hello Gurus,

I am facing problem when passing values in lastPeriods(). I want to get the set of months that ends with the Report month choosen by the users. So, I created a data item with expression lastPeriods(7,[ReportMonth]) , which is working fine in my report.

Now I am trying to pass the value instead of hard coding value '7'. So, created a data item which is returning the month number, like for June 2011 the month number will be 6. And I used the expression as lastPeriods([Month NBR),[ReportMonth]). But it is not working. I want to pass the value because this is not constant and dependent on the report month.

I don't know where am I wrong.

Please help me in this regard. it's very urgent requirement.

thank you in advance!!!
Title: Re: passing values in lastPeriod()
Post by: kalyanapu on 19 Sep 2011 07:47:43 PM
As per my understand,
"lastPeriods " expects only inter value.
Syntax: lastPeriods ( integer_expression , member )
But you are passing the value as String like '7'
That means syntax violation is happening when you are parsing the syntax.
"If you have a month value as String in database, convert into number or integer."
Then it works well.

Best Regards.
Srinivas Kalyanapu
Title: Re: passing values in lastPeriod()
Post by: cham on 19 Sep 2011 10:43:52 PM
Thanks Srinivas for your reply.

Actually I am passing integer value. Just to check I created a data item with integer constant 7. and I am trying to use that data item in lastPeriods([dataitem],[Report Month]). the result is null.

Any help on this?
Title: Re: passing values in lastPeriod()
Post by: cham on 20 Sep 2011 10:43:35 AM
Hello Gurus,

Any help on this?