Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
chavanqlik
Partner - Contributor III
Partner - Contributor III

Set or Create Alternate set using Visualization API

 

How to set or create alternate state using visualization API, could anyone place share the insights on this?

 

app.visualization.create(

  'table',

  [

    {

      "qDef": {

        "qFieldDefs": [

          "=If(Par>3,TClubName)"

        ],

        "qFieldLabels": [

          "Tee club"

        ],

        "qSortCriterias": [

          {

            "qSortByLoadOrder": 1

          }

        ]

      },

      "qNullSuppression": true

    },

    {

      "qDef": {

        "qLabel": "#",

        "qDef": "Count(HoID)"

      },

      "qAttributeExpressions": [

        {

          "qExpression": "If(Count(HoID)<10,RGB(255, 115, 115))",

          "id": "cellForegroundColor"

        }

      ]

    },

    {

      "qDef": {

        "qLabel": "FIR%",

        "qDef": "Avg(FwHit)",

        "qNumFormat": {

          "qType": "F",

          "qnDec": 2,

          "qUseThou": 0,

          "qFmt": "0.0%",

          "qDec": ".",

          "qThou": ","

        }

      },

      "qAttributeExpressions": [

        {

          "qExpression": "If(Avg(FwHit)<0.5,RGB(255, 115, 115),If(Avg(FwHit)>0.7,RGB(145, 194, 106)))",

          "id": "cellBackgroundColor"

        }

      ]

    },

    {

      "qDef": {

        "qLabel": "Avg",

        "qDef": "Avg(DrDist)",

        "qNumFormat": {

          "qType": "F",

          "qnDec": 2,

          "qUseThou": 0,

          "qFmt": "#,##0.00 m",

          "qDec": ".",

          "qThou": ","

        },

        "numFormatFromTemplate": false

      }

    },

    {

      "qDef": {

        "qLabel": "Max",

        "qDef": "Max(DrDist)",

        "qNumFormat": {

          "qType": "F",

          "qnDec": 2,

          "qUseThou": 0,

          "qFmt": "#,##0 m",

          "qDec": ".",

          "qThou": ","

        },

        "numFormatFromTemplate": false

      }

    }

  ],

  {

    "showTitles": true,

    "title": "Off the tee (Par 4s and Par 5s)"

  }

).then(function(vis){

  vis.show("QV01");

});

 

 

//I tried this way didn't work

    app.visualization.create(

                'table',

                [{

                        "qDef": {

                            "qFieldDefs": [

                                "[EMR_CODE]"

                            ],

                            "qFieldLabels": [

                                "MRN"

                            ],

                            "qSortCriterias": [{

                                "qSortByLoadOrder": 1

                            }]

                        },

                        "qNullSuppression": true

                    },

                    {

                        "qDef": {

                            "qFieldDefs": [

                                "[REGNO]"

                            ],

                            "qFieldLabels": [

                                "REGNO"

                            ],

                            "qSortCriterias": [{

                                "qSortByLoadOrder": 1

                            }]

                        },

                        "qNullSuppression": true,

                        "qStateName": "DRGSelect",

                    },

 

                ], {}

            ).then(function (vis) {

                vis.show("QV1");

            });

 

It didn't work..:(

 
Labels (2)
0 Replies