COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: LOUM on 26 Jun 2012 12:48:44 PM

Title: UNION Query sorting on report
Post by: LOUM on 26 Jun 2012 12:48:44 PM
Good Day everyone:

I have a union query which has header and detail information in it based off of one file. The key to which is header and which is detail in which the identifier is BH = Header, BD = Detail.

When I run my report I have it sorting on the PO number.

My problem is that it is not keeping the Header record with the detail record when the report displays. Sometimes it brings in the header records and others times it does not.

I want the report to look like the example below:

Header:
PO-12345    BH     Vendor        Dollar Value     Expr Date

PO - 12345  BD    Line 1  Item Number     QTY         Dollar Value
                            Line 2  Item Number     QTY         Dollar Value
                            Line 3  Item Number     QTY         Dollar Value
                            Line 4  Item Number     QTY         Dollar Value

I thought I could handle it on the sort portion of the report but I am unsuccesful.

Any suggestions would be great.

Thank you.
LM



Title: Re: UNION Query sorting on report
Post by: blom0344 on 26 Jun 2012 01:38:38 PM
Use '1.BH' and '2.BD' as a second order dataitem. This will give all data sorted on the PO order number first and automatically show the header record first.

Alternatively create a master - detail report with 2 seperate queries instead  of the union..
Title: Re: UNION Query sorting on report
Post by: LOUM on 02 Jul 2012 09:00:28 AM
Blom:

Thank you for your assistance. Went with option two and it is working spiffy.

;D


Lou