Cognos Analytics

Expand all | Collapse all

HINT: add comments to your Report QueryItems

  • 1.  HINT: add comments to your Report QueryItems

    Posted 21 days ago

    Been working with Cognos for 17+ years now ... and thought, I know it all ... :-)

    Found this nice option to add comments in queryItems to make report-queries easier to understand:

    #/*Here are the comments*/#

    Source: How to add comments for expressions in Report Authoring tools in Cognos Analytics 11.

    Hope this helps. 



    ------------------------------
    Ralf Roeber
    ------------------------------


  • 2.  RE: HINT: add comments to your Report QueryItems

    Posted 19 days ago
    Edited by Michael Walter 14 days ago
    Been working with Cognos 8+ years, now, and quite sure I don't know it all...

    But I found how to add comments early on, and will share a tip that's been quite helpful to me. Comment your filters at the top with a short description of what they do, e.g.:

    #/* TransDate in Range per params */#
    [MyDataSet].[Orders].[TransactionDate] BETWEEN ?StartDate? AND ?EndDate?​

    This avoids the need to open each filter to see what it does, as its purpose appears in the filters listing when you view the query—the trick is to keep the filter description short enough to see in the preview area. Much more useful than seeing just the first part of a long filter statement.

    It also helped me remember them, to know why the comment markers are "#/*":  slash (/) asterisk (*) is the standard​ for SQL comments, and the pound sign (#) [or octothorp] tells Cognos "don't try to parse what follows into SQL; ignore between # and #."​​

    ------------------------------
    Michael Walter
    Business Analyst
    TX HHSC
    Austin
    ------------------------------



  • 3.  RE: HINT: add comments to your Report QueryItems

    Posted 18 days ago
    Ralf,  This was super helpful. I've been looking for this for a long time. 

    Basically a SQL comment surrounded by the '#' sign.  Nice.

    Happy New Year!

    Jeanie​

    ------------------------------
    Jeanie Krieger
    Business Analyst
    California State University, Sacramento
    Sacramento CA
    ------------------------------



  • 4.  RE: HINT: add comments to your Report QueryItems

    Posted 16 days ago
    Hi Ralf, 

    thanks for the contribution, very useful!!!!

    Javier.

    ------------------------------
    Javier Sendra
    ------------------------------



  • 5.  RE: HINT: add comments to your Report QueryItems

    Posted 16 days ago

    Yep – that's been around for quite a while. I wrote myself a blog post back in the day to remind myself of the format:
    http://cognostips.weebly.com/blog/comments-in-fields

     






  • 6.  RE: HINT: add comments to your Report QueryItems

    Posted 14 days ago
    Yes it's Cognos 8 feature. I hope it can be improved to use standard commenting method used in Data Modules or May be adding a Comment property to each Data item and query would make it easy to document XML spec.

    ------------------------------
    Buddhi Gupta
    ------------------------------



  • 7.  RE: HINT: add comments to your Report QueryItems

    Posted 12 days ago
    Thanks Ralf for this great tip! Thanks also to Michael for expanding it to filters as well. Been wondering how to do this in Cognos for some time now, and I just stumbled upon this thread. Great resource!

    ------------------------------
    Rio Benavides
    ------------------------------



  • 8.  RE: HINT: add comments to your Report QueryItems

    Posted 11 days ago

    Hi, 
    This applies to any location that you can edit an expression via the expression editor. FM, Reports, Calculations, Filters etc.

    In Compatible Query Mode expressions can be commented only via the Embedded Macro Expression and so the following are valid forms:
        Expression text:  The expression is effectively the value 14
            #/* cqm and dqm compatible one line comment, via a macro expression */#
            14
            # // comment inside a macro function, to end of line
            #
            # /* multi
            line
            comment in a macro expression */ #
            #
            /* inside a macro expression
            a multi-line comment
            */
            #

    In Dynamic Query Mode the above methods are valid as well as all the following ones:
        Expression text:  The expression is effectively the value 14
        Tested this with 11.0.13 , 11.1.1 and 11.1.7
            // comment to end of line
            14    // the rest of the line is a comment
            /* multi-line comment, here used on a single line */
            /* multi-line comment
            using two lines */


    I will put in a request to update the documentation around this.
    // Henk


    ------------------------------
    HENK CAZEMIER
    ------------------------------



  • 9.  RE: HINT: add comments to your Report QueryItems

    Posted 6 days ago
    @HENK CAZEMIER
    Thank you for explaining even more details on this feature.
    To update the documentation a bit is a good idea.​

    Saw this one: https://www.ibm.com/support/pages/how-add-comments-expressions-report-authoring-tools-cognos-analytics-11
    Good job! 1st place on google search results "ibm cognos query item comment"

    A tip/hint on this https://www.ibm.com/support/knowledgecenter/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ug_cr_rptstd.doc/t_cr_rptstd_wrkdat_insert_singleton.html
    could be helpfull. 

    Thank you for pushing this on.

    @Buddhi Gupta: ​Good idea to enforce best practices on documentation. Yes.

    Good to know, that it helped!

    ------------------------------
    Ralf Roeber
    ------------------------------



  • 10.  RE: HINT: add comments to your Report QueryItems

    Posted 3 days ago

    Henk, the information we put into the redbook (i.e. chapt 4)  should be in the docs if I recollect.

    http://www.redbooks.ibm.com/abstracts/sg248121.html?Open



    ------------------------------
    NIGEL CAMPBELL
    ------------------------------