Cognos Analytics

 View Only
  • 1.  Invalid coercion from 'member' to 'string'

    Posted Mon November 23, 2020 11:02 AM
    As part of an Interactive Report I am creating, i'm attempting to create a data item that concatenates a two members from a Data Source/Package. I.e. I have 1 column for "Part", 1 for Reported Concern, I would like another column that joins those two, as shown below.
    I have tried several versions, such as:

    1. concat([Reported Part],[Reported Concern])
    2. concat(children([Reported Part]),children([Reported Concern]))
    3. [Reported Part] + [Reported Concern]

    However, I keep getting errors such as below:

    1. Invalid coercion from 'member' to 'string' for ….
    2. Invalid coercion from 'memberSet' to 'string' for 'children...
    3. The operands of ….. cannot be converted to consistent dimensional object.

    Any help / info would be greatly appreciated as I am quite new to Cognos.

    Thanks

    ------------------------------
    Dale Simpson
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Invalid coercion from 'member' to 'string'

    Posted Mon November 23, 2020 03:13 PM
    FYI, I was able to work through this issue by selecting a different child from the data source, as shown below.



    ------------------------------
    Dale Simpson
    ------------------------------



  • 3.  RE: Invalid coercion from 'member' to 'string'
    Best Answer

    Posted Mon November 23, 2020 05:19 PM

    Hi Dale,
    Glad to see that you worked it out by using the property of a level.

    Also, you can use the caption function to get the string representation of a level.

    E.g.   caption([some_level]) + caption( [some_other_level])

    // Henk




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



  • 4.  RE: Invalid coercion from 'member' to 'string'

    Posted Mon November 23, 2020 05:55 PM
    Thanks for the ​extra info. Trying to learn on my own here so every little bit helps!

    ------------------------------
    Dale Simpson
    ------------------------------



  • 5.  RE: Invalid coercion from 'member' to 'string'

    Posted Wed November 25, 2020 08:03 AM

    When you refer to a dimensional object (level, hierarchy, member) etc, you may encounter cases, where you need to refer to a property of the object (i.e. caption). https://www.ibm.com/support/knowledgecenter/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ug_fm.doc/c_roles_relational.html

    FYI, the operator to join items/expressions of character types is ||.

    If you are familiar with databases, some may follow the SQL standard (||), may overload the addition (+) operator or force you to use a function such as concat. I'd suggest you use ||. Should you find yourself writing Cognos SQL in a report/model, it expects || as opposed to + which you can us in our expression syntax.



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