COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ccbarbeau on 13 Aug 2013 09:10:11 AM

Title: Extracting equation from a data field to create data item
Post by: ccbarbeau on 13 Aug 2013 09:10:11 AM
Morning,

I am using a table in a DB2 database that has the following format:

Sequence            Description            Equation
      1                    123456                 ([LINE] *EQ "XXX" & [PRODUCT]=%VALUES(01 02 03 04 05))

What I am trying to acheive is to extract the equation field to create a new data item that would return the description. ie, if line = XXX and Product = 01, then the data item would return 123456.

Thought? I'd really like to avoid writing 125 different IF statements. Plus, the table is dynamic, and I am not made aware of changes to it. Those multiple IFs would require monthly double-checking, which if not efficient to say the least.

Many thanks.
Title: Re: Extracting equation from a data field to create data item
Post by: blom0344 on 14 Aug 2013 02:24:54 AM
This makes little sense.. You want the value of description returned that is stored within the table column 'description'  Where do you need the equation for ?
Can you clarify ?
Title: Re: Extracting equation from a data field to create data item
Post by: ccbarbeau on 22 Aug 2013 07:11:02 AM
I must admit this is not the clearest post. I'll try again.

The table contains information that is updated by another department. I need to extract the data in the description field to use as a filter. I don't want to write a giant filter manually, because there are about 150 lines in the table and they are subject to change without my being advised.
Title: Re: Extracting equation from a data field to create data item
Post by: blom0344 on 22 Aug 2013 07:43:08 AM
Something like:

Select Description from sometable where equation like '%XXX%' and equation like '%01%'

This may return 0, 1 or more than one result. Now, if the where part of the above query is fixed (no changes) then you can code it. To use it as a filter, you could wrap it in its own query subject with crossjoins allowed in report, or better still define a mandatory prompt with this as the prompt query. The prompt parameter then holds the value of the returned description, to be use within other queries as a filter.
Point is, how do you know exactly 1 result is returned and is the where clause static or also dynamic?