COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: gutterline on 08 Feb 2011 08:16:11 AM

Title: Referencing different queries in the same report
Post by: gutterline on 08 Feb 2011 08:16:11 AM
I have a report that contains 5 queries.  I need to be able to reference one query from another for a reporting total function.

I know there has to be a way to make one query reference another, just to use a field.

I probably haven't described this very well and if more information is needed, I'll be more than happy to elaborate.

Thanks,
Mark
Title: Re: Referencing different queries in the same report
Post by: melee on 08 Feb 2011 09:15:49 AM
I don't have a solid look on this, but I've been able to filter by other queries by simply including the full path of the data item - for example, [DATAITEM1] in [Query1].[Count Total]

Where DATAITEM1 resides in Query2 or something similar. i haven't tried this as a straight up data item, but I'd assume that as long as you're bringing a total and not creating a join, it should work. I'll test it and get back to you with a definitive.
Title: Re: Referencing different queries in the same report
Post by: redmist on 08 Feb 2011 11:25:05 AM
what melee is suggesting is like a sub query. I believe you will have to enable outer join for that to work, so make sure Query1 has only 1 record
Also think the syntax has to be [DATAITEM1] in ([Query1].[Count Total])
Title: Re: Referencing different queries in the same report
Post by: melee on 08 Feb 2011 11:30:02 AM
Yeah, my pseudo code never renders correctly :P