Cognos Analytics

 View Only
  • 1.  User defined functions

    Posted Tue April 13, 2021 06:35 AM
    Hi,

    We want to create a user defined function in cognos, which will calculate the business hours between 2 dates.
    The parameters to the function will be - StartDate, EndDate, fromTime,toTime,NoOfDays

    Is there a way in cognos to create a user defined function or a macro function?


    Thanks,
    Vaibhav

    ------------------------------
    Vaibhav Pujari
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: User defined functions

    Posted Wed April 14, 2021 08:37 PM
    Hi Vabhav,

    Specifically addressing Macro Functions:

    Cognos Analytics:

    https://www.ibm.com/docs/en/cognos-analytics/10.2.2?topic=SSEP7J_10.2.2/com.ibm.swg.ba.cognos.ug_fm.10.2.2.doc/c_macro_functions.html


    An additional outside source for Macro Functions::

    Macro Functions:

    https://bi-solutions.gaussling.com/macro-functions-in-cognos-report-studio/


    Creating Custom Report Functions:

    https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=ccrffs-creating-custom-report-functions#cstmfnctns_creating_report_functions


    Creating Custom Report Functions and Function Sets:

    https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=sdkdg-creating-custom-report-functions-function-sets

    An excellent source of information in terms of calculating business hours between two dates, the following link provides options to calculate your start and end dates.  It also provides suggestions on simplifying the processes of creating your user defined functions.

    https://www.cognoise.com/index.php?topic=25142.0


    There is a process you go through in IBM in creating and calculating start and end dates.  The above stated links will guide you in the right direction.

    I found the information on creating report expressions helpful because some expressions are available by default, such as Today(), ReportDate(), ReportName().  There's also a section on defining functions, identifying functions in the function definition service, and then creating custom functions (user defined).

    I sincerely hope this helps Vabhav.

    Yvonne



    ------------------------------
    Yvonne R. McGinnis
    DevOps (hopeful), Systems Administration
    Obama Foundation, Chicago
    Chicago Cato, Illinois
    773-886-5579
    ------------------------------