COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: RobSil on 28 Jan 2010 02:30:45 PM

Title: Query Question
Post by: RobSil on 28 Jan 2010 02:30:45 PM
Is it possible to extract query data to be placed in a header?

My data set is homeroom and students such that the rows would look like...

[Homeroom][TeacherName][StudentName]

So 5 rows of data might be...
RoomA, Mr. Jones, Frank Smith
RoomA, Mr. Jones, Julie Anderson
RoomA, Mr. Jones, Steve Sullivan
RoomB, Mrs. Anders, Allison McGrath
RoomB, Mrs. Anders, Jenny Johnston

My report is passed "Homeroom Name" as a param (?HNParam?).  I want there to be a section at the top with 3 text items...

Homeroom Name:  (print HNParam.. done)
Homeroom Teacher: (print "Mr. Jones" if ?HNParam?= RoomA e.g.)
Number Students: (print 3 if ?HNParam?= RoomA e.g.)

My theory is to create a query "SummaryDataQuery" and extract details from that... but when I try this I get errors when I attempt to add a query data item to my Text Item expression.  The error is just the stack trace so not sure what the issue is.  Since it's single data, the info could be extracted into a query, or into variables/parameters if that's possible?

Does anyone know how to accomplish what I've described?

Thx,
Rob

Title: Re: Query Question
Post by: paddhu on 28 Jan 2010 11:59:18 PM
The problem is because, Text Items in Cognos layout cannot hold Query elements. They can only hold custom text or layout expressions. What you can do is use a singleton (v8.3 or higher) or use a list and hide the title and border to get the required layout effect.
Title: Re: Query Question
Post by: TheDarkKnight on 29 Jan 2010 12:45:59 AM
Yes, Singleton is a gud option to use. i will go with using list for the same i tried this it worked perfectly!!! :).
Title: Re: Query Question
Post by: MFGF on 29 Jan 2010 05:19:20 AM
Hi Rob,

Are you on 8.3 or later?  If so, dragging in singletons from the toolbox as Paddhu and TheDarkKnight have suggested will be the easiest option.  Otherwise, drop a list into the page header as suggested, or alternatively drag a Repeater to the page header, drop a block inside the repeater, and drag your Homeroom, Teacher and a calculation to count the Student items into this (with text items between them, containing a comma and a space).

Regards,

MF.
Title: Re: Query Question
Post by: RobSil on 01 Feb 2010 11:36:25 AM
Thanks for the input!  I am trying a table now... but the grid lines won't go away!  At what level should I hide the border?  I've tried every level that I can think of (column item, list, etc.) but the border stays as a thin green line.

Not sure why it is being so difficult to do... I've even removed the style class of the table to see if that would work to no avail.

Thoughts?

R.
Title: Re: Query Question
Post by: RobSil on 01 Feb 2010 01:20:56 PM
Finally found it!

You have to override the class on the "List Column Body" to be none.  I tried pretty much every level of the structure except for that one I think! lol.