Cognos Analytics

Cognos Analytics

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

 View Only
  • 1.  queryValue() macro in Framework Manager

    Posted Tue September 14, 2021 01:11 PM
    Edited by System Admin Fri January 20, 2023 04:40 PM
    Hello, using here Cognos Analytics 11.1.5 and Framework Manager 11.1 with a model with DQM.

    Anybody knows if the queryValue() macro is supported in Framework Manager. I'm trying to use it but I always get this error:

    XQE-V5-0005 Identifier not found


    I have tried with
    #sq(queryValue('[Namespace].[Query Subject].[Query Item]'))#

    and

    #queryValue('[Namespace].[Query Subject].[Query Item]')#​


    If I try the query item without the macro it works:

    [Namespace].[Query Subject].[Query Item]

    ​​​​

    ------------------------------
    Alex Santamarta
    ------------------------------
    #CognosAnalyticswithWatson


  • 2.  RE: queryValue() macro in Framework Manager

    Posted Wed September 15, 2021 04:53 AM
    QueryValue() is supported, but the syntax you are using is wrong.
    CognosPaul has a nice intro: Take a look at https://cognospaul.com/2019/06/06/quickie-use-new-macro-function-queryvalue/

    Good Luck

    ------------------------------
    Sandeep Dhirad
    Elkjøp Nordic
    ------------------------------



  • 3.  RE: queryValue() macro in Framework Manager

    Posted Tue September 21, 2021 10:35 AM
    I don't think the syntax is wrong. If I use it in a Cognos report instead of Framework Manager it works and I don't get any error.

    I put this queryValue() macro in a filter in a Query Subject and published the package (the package also gave me a validation error) and then made a report with the query subject and the report service didn't return an error and the filter worked as expected.

    ------------------------------
    Alex Santamarta
    ------------------------------



  • 4.  RE: queryValue() macro in Framework Manager

    Posted Wed September 15, 2021 10:10 AM
    The queryValue function expects only a single value to be returned, so if you have more than one value in your query item, I don't think it will work unless you add a filter expression. 

    # sq ( queryValue ( 'TheCalendar.TheWeekdayName' , 'TheCalendar.TheDate = 2018-06-06' ) ) #

    So, you could try something like this and it should work:
    #queryValue('maximum([Namespace].[Query Subject].[Query Item])')#​
    #queryValue('minimum([Namespace].[Query Subject].[Query Item])')#​
    #queryValue('total([Namespace].[Query Subject].[Query Item])')#​


    ------------------------------
    Jonathan McKnight
    5x IBM Champion
    Business Intelligence Analyst
    Nashville, TN
    www.linkedin.com/in/jonathanmcknight
    ------------------------------



  • 5.  RE: queryValue() macro in Framework Manager

    Posted Tue September 21, 2021 10:40 AM
    My experience is that if the expression inside the queryValue() macro returns more than one value (with or w/o filter), it will take only one of them.

    ------------------------------
    Alex Santamarta
    ------------------------------



  • 6.  RE: queryValue() macro in Framework Manager

    Posted Wed September 22, 2021 04:41 AM
    Is this in a multi-package report? Can you try this in a completely new report pointing only to that package?

    ------------------------------
    Paul Mendelson
    ------------------------------



  • 7.  RE: queryValue() macro in Framework Manager

    Posted Fri September 24, 2021 12:00 PM
    Hi Paul,

    The package contains only a relational framework manager model. But the problem is not in the report, but in the validation in Framework Manager.

    Even though Framework Manager returns this error during the validation of the expression and the validation of the package:
    XQE-V5-0005 Identifier not found

    When I publish the package (with the offending expression in the embedded filter of a query subject) and then I make report using this query subject, the reports behaves as expected and doesn't give any error.

    So, for me the problem doesn't exist any more. Only that every time I validate the package I get a validation error.

    ------------------------------
    Alex Santamarta
    ------------------------------



  • 8.  RE: queryValue() macro in Framework Manager

    Posted Fri September 24, 2021 06:44 PM
    Okay, I understand what's happening. There are a few cases where certain calculations will fail validation in Framework Manager, but still execute as expected in the reports. Usually this is with package contextual calculations, such as queryValue.

    ------------------------------
    Paul Mendelson
    ------------------------------