COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tennjay on 25 Nov 2014 09:15:30 AM

Title: Sort by count or number of pages
Post by: tennjay on 25 Nov 2014 09:15:30 AM
Hi All,

I am trying to make Customer statements sort by the number of pages per statement. The statements are printing fine except for the sort order. It is a relational database, and I am using 10.2.

My thinking is that I will need to calculate the number of transactions, and then use that number in my overall sort; However, I can't seem to get that to work. Any ideas on how I can get it to work?

Thanks,

Jay
Title: Re: Sort by count or number of pages
Post by: Lynn on 25 Nov 2014 10:55:30 AM
It would help if you provide some detail. If you look at the forum etiquette thread you will see that generic comments like "it doesn't work" may not be the best way to get the help you seek.

How did you calculate the transactions? What was that expression? How did you specify that as your sort and what was the outcome? An error or just didn't behave as expected? If it was an error then tell us the message. If you used a calculation in layout sorting is it also in your layout or associated to the layout in the "properties" property?
Title: Re: Sort by count or number of pages
Post by: tennjay on 25 Nov 2014 11:37:03 AM
Sorry for the lack of detail. It may be better to explain what I am trying to accomplish. I need my statements to come out in groupings by number of pages per statement. This is so that they can be ran through a folder/ mailing machine. All customers with single page statements print together, customers with 2 page statements print together, customers with 3 page statements print together, etc.

The statement report has already been written, and this is an enhancement. The current report, when printed to PDF, prints out in customer number order and correctly displays the "Page 1 of " page numbering style.

I am fairly new at BI and don't know how to proceed. Since a statement's final page count is not known until after it is rendered in PDF, I am assuming (yes, I know) that I will have to come up with a count of lines that each statement will contain and use this as my first sort item followed by the customer number. I do not know how to accomplish this.

The attachment is an example of my raw data with the Count that I would need to sort on.

I really appreciate your help.


Title: Re: Sort by count or number of pages
Post by: Lynn on 25 Nov 2014 11:46:28 AM
Try adding a new data item to your query with an expression something like this:

count ( [Accounts Receivable Invoice] for [Customer ID] )

Associate this to your layout by adding it in the list's "Properties" property. You need to do this because you want to reference it as part of the sorting but it doesn't appear anywhere in your list container. Then go to the list's layout sorting and add this item in above the customer ID or whatever element is currently the basis for the sort.
Title: Re: Sort by count or number of pages
Post by: tennjay on 25 Nov 2014 12:06:33 PM
You are awesome! I was making this a lot harder than it needed to be.  Thanks!!
Title: Re: Sort by count or number of pages
Post by: Lynn on 25 Nov 2014 12:28:49 PM
Glad you got what you needed!