COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: karthik12345 on 11 Apr 2016 05:06:16 AM

Title: creating the data items by using sql queries
Post by: karthik12345 on 11 Apr 2016 05:06:16 AM
Hi all,
   
    How can i create the data items in report studio by using sql queries.
   i.e data item1 -> select emp-name from emp  where emploc='us' and empsal<10000
   i want emp-name have to meet the above criteria, how can i achieve this.

Thanks,
Karthee
 
Title: Re: creating the data items by using sql queries
Post by: BigChris on 11 Apr 2016 05:33:32 AM
That just looks like a simple filter - you're likely to need something like:

[EmpLoc] = 'us' and [EmpSal] < 10000
Title: Re: creating the data items by using sql queries
Post by: karthik12345 on 11 Apr 2016 06:02:44 AM
Thanks Chris,
 
      But i have the show in other data item 2-> data item1 -> select emp-name from emp  where emploc='AUS' and empsal<10000

Thanks,
karthee
Title: Re: creating the data items by using sql queries
Post by: MFGF on 11 Apr 2016 06:09:14 AM
Quote from: karthik12345 on 11 Apr 2016 06:02:44 AM
Thanks Chris,
 
      But i have the show in other data item 2-> data item1 -> select emp-name from emp  where emploc='AUS' and empsal<10000

Thanks,
karthee

Why are you trying to create a report populated by hand-coded SQL rather than based on a package?

MF.
Title: Re: creating the data items by using sql queries
Post by: karthik12345 on 11 Apr 2016 10:50:03 AM
 
   Just i am trying to know whether it is possible or not.

Thanks,
Karthee
Title: Re: creating the data items by using sql queries
Post by: MFGF on 11 Apr 2016 10:57:51 AM
Quote from: karthik12345 on 11 Apr 2016 10:50:03 AM
 
   Just i am trying to know whether it is possible or not.

Thanks,
Karthee

You can base a query on a SQL statement if you need to. You can then join / union etc multiple queries into one in your report, so yes, it's possible. It's not elegant or efficient or easily maintainable or recommended, though.

Cheers!

MF.
Title: Re: creating the data items by using sql queries
Post by: BigChris on 12 Apr 2016 02:10:52 AM
QuoteIt's not elegant or efficient or easily maintainable or recommended, though.
But other than that, go for it.