Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
vegard_bakke
Partner - Creator III
Partner - Creator III

Is it possible to get expressions in a qListObject in a mashup?

I've tries setting up a qListObject in a mashup, with one dimension, and one extra expression.

However, the expression is always returning blank:

    1. 0:{qText: "01", qNum: 1, qElemNumber: 0, qState: "O", qFrequency: "0.233931"}
    2. 1:{qText: "-", qNum: "NaN", qElemNumber: 0, qState: "L"}

The definition I've been trying is this:

app.createList({

    "qFrequencyMode": "R",

    "qDef": {

            "qFieldDefs": [

                    "RegionNo"

            ],             

            "qSortCriterias": [

                {

                    "qSortByExpression": 1,

                    "qExpression": {

                        "qv": "=RegionNo"

                    }

                }

            ]

    },

    "qExpressions": [

            {

                    "qDef": {

                            "qDef": "=Count(RegionNo)"

                    },

                    "qLabel": "=Count(RegionNo)",

                    "qLibraryId": null

            }

    ],

   

    "qInitialDataFetch": [

            {

                    "qHeight": 20,

                    "qWidth": 2

            }

    ],

    "qLibraryId": null

},onDataTest);

The current =Count(RegionNo) is just attempt to avoid any mistakes in Qlik expression. Ideally, it should be replaced by =Only(RegionName)
Both return qText: "-", qNum: "NaN".

1 Solution

Accepted Solutions
vegard_bakke
Partner - Creator III
Partner - Creator III
Author

Thank you, Erik! Your insight is always appreciated!

Here is a fully working "list", with both a RegionNo, and the RegionName.

It is a hypercube, but it returns all rows, not just the selected rows, like a hypercube does by default.

app.createCube({

    "qInitialDataFetch": [

        {

            "qHeight": 20,

            "qWidth": 2

        }

    ],

    "qDimensions": [

        {

            "qDef": {

                "qFieldDefs": [

                    "RegionNo"

                ]

            },

            "qNullSuppression": true,

            "qShowAll": true

        }

    ],

    "qMeasures": [

        {

            "qDef": {

                "qDef": "MinString( {< Region=,RegionNo=,RegionName= >} RegionName)"

            },

            "qLabel": "Region",

            "qLibraryId": null,

            "qSortBy": {

                "qSortByState": 0,

                "qSortByFrequency": 0,

                "qSortByNumeric": 0,

                "qSortByAscii": 1,

                "qSortByLoadOrder": 0,

                "qSortByExpression": 0,

                "qExpression": {

                    "qv": " "

                }

            }

        }

    ],

    "qSuppressZero": false,

    "qSuppressMissing": false,

    "qMode": "S",

    "qInterColumnSortOrder": [],

    "qStateName": "$"

}, onDataTest);

(Sorry Erik, for marking my own answer as correct. But the full code might be better for other people later. Thanks again!)

View solution in original post

7 Replies
ErikWetterberg

Hi,

The documentation is sometimes hard to read, but I think it should be:

qExpressions: [

{

qExpr: "=Count(RegionNo)"

}

]

Please let us know if this helps.

Erik Wetterberg

vegard_bakke
Partner - Creator III
Partner - Creator III
Author

Thank you for your reply!

Unfortunately, qExpr: "=Count(RegionNo)" yields the same result, qText: "-", qNum: "NaN".


The code above is generated by Qlik Sense Feb 2018 SR1, when using the 'Add List' (or 'Add Hypercube'), to the right under Options in Mashup DevHub editor.


I hope that Qlik is generating code that itself understands. But, I guess this is an area that's not used or tested that much, maybe...

ErikWetterberg

Hi,

Didn't realize you used the Mashup Generator, have you tried reporting this as a bug??

Erik Wetterberg

ErikWetterberg

Hi,

You could try with a HyperCube instead. Set qShowAll on the dimension, it should give you all values, like a ListObject.


Erik Wetterberg

vegard_bakke
Partner - Creator III
Partner - Creator III
Author

Thank you, Erik! Your insight is always appreciated!

Here is a fully working "list", with both a RegionNo, and the RegionName.

It is a hypercube, but it returns all rows, not just the selected rows, like a hypercube does by default.

app.createCube({

    "qInitialDataFetch": [

        {

            "qHeight": 20,

            "qWidth": 2

        }

    ],

    "qDimensions": [

        {

            "qDef": {

                "qFieldDefs": [

                    "RegionNo"

                ]

            },

            "qNullSuppression": true,

            "qShowAll": true

        }

    ],

    "qMeasures": [

        {

            "qDef": {

                "qDef": "MinString( {< Region=,RegionNo=,RegionName= >} RegionName)"

            },

            "qLabel": "Region",

            "qLibraryId": null,

            "qSortBy": {

                "qSortByState": 0,

                "qSortByFrequency": 0,

                "qSortByNumeric": 0,

                "qSortByAscii": 1,

                "qSortByLoadOrder": 0,

                "qSortByExpression": 0,

                "qExpression": {

                    "qv": " "

                }

            }

        }

    ],

    "qSuppressZero": false,

    "qSuppressMissing": false,

    "qMode": "S",

    "qInterColumnSortOrder": [],

    "qStateName": "$"

}, onDataTest);

(Sorry Erik, for marking my own answer as correct. But the full code might be better for other people later. Thanks again!)

vegard_bakke
Partner - Creator III
Partner - Creator III
Author

No, I haven't. Unfortunately, a bug takes longer to get fixed, than making a work around.  😕

vegard_bakke
Partner - Creator III
Partner - Creator III
Author

Just an additional comment:

The qShowAll is not enough. There has to be an expression as well.