cognoscognos-11

How do I add a watermark to Cognos report with user id and user login time?


How do I add a watermark to Cognos report with user id and user login time ?


Solution

  • I don't know about adding a watermark, but you could add that information to the page (I would use the footer) using some of the many macro functions and parameters available on the Macros tab of the Data Item Expression dialog.

    I am using an Active Directory namespace, so I would add user id with:

    #sq($account.personalInfo.userName)#
    

    To add the session start time, you'll probably need the Audit database working. I would create a query that results in SQL that looks like:

    select l.COGIPF_LOCALTIMESTAMP
    
    from COGIPF_USERLOGON l
    
    where l.COGIPF_LOGON_OPERATION = 'Logon'
      and l.COGIPF_SESSIONID = 'F14BADE9BABDB106F4A8ACEC7962D7F4B4002E012F1FFA312A7D86E533D5E21A'
    

    The sessionID returned by the macro will include additional information at the beginning. You may be able to get away with a filter that looks like this:

    [Audit].[User Logins].[Session ID] = substring(#sq($sessionID)#, 5, 64)
    

    But there may not always be exactly 4 leading characters and the session ID may not always be exactly 64 characters. You'll need to test.