Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
  • 1.  Declaring vaqiable in cognos abalytics

    Posted Fri July 28, 2023 10:54 AM

    I am trying to convert a crystal report to Cognos analytics report..

    In my crystal reports formula, I declare a string variable and store some field information based on certain condition. Then in my group footer, I display the values using another formula.

    ex: 

    StringVar vendors;
    NumberVar vendCount;
    If {table.Item} ="I001" then
    (
        vendCount := vendCount +1;
        vendors := vendors + ", " + {table.VendorName}
    )

    I want to do similar this with Cognos and would like to know whether it is possible to create a variable, assign values and display them in group footer.

    Any help is greatly appreciated.



    ------------------------------
    Don Perera
    ------------------------------


  • 2.  RE: Declaring vaqiable in cognos abalytics

    Posted Mon July 31, 2023 08:34 AM

    Hi Don,

    I assume you need a query calculation to achieve that. Here's an example on IBMs demo data:

    I used the GO Sales (Query) package and wanted to count numbers of order lines where order method is 'Telephone".

    The underlying calculation looks like this and I set it to count - you can use "total" as well:

    I then added a footer to the page and created a "Singleton" there. Keep in Mind that you have to enable some data items in the "properties" setting. Otherwise, Cognos will only put those columns into the query that are used in the layout. This could lead to incomplete data as the query service doesn't know your grain of data. In my case it would only generate an SQL with the order method table in the FROM section and the counter then will return "1". Therefore I have to force the system to create a join to the sales order table by enabling the corresponding column:



    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------