Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kikko
Contributor II
Contributor II

kpi object in mashup does not refresh after selections

Ok guys! I'm getting crazy with the behaviour of a KPI object I have created on the fly with visualization API.

The object is correclty loaded but when I apply a filter the value shown in the KPI object deosn't change!!!

As an example if the first selection gives 20% I can see 20% in my webpage but if I do a second selection the visualization not refresh! I need to reload the page to see the value change!! This is unbelivable! 

I'm sure I'm doing something wrong but I can't understand what I'm doing wrong.

 

Can you please help me!

This is the code I've used to develop my KPI object:

app.visualization.create( 
	'kpi',
	  [
		{
      "qDef": {
        "qLabel": "",
        "qDef": "[KPI.KPI_ANS]",
        "qNumFormat": {
		"qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
          
        },
		"conditionalColoring": {
          "useConditionalColoring": true,
          "segments": {
            "limits": [
              {
                "value": {
                  "qValueExpression": {
                    /*"qExpr": "=concat(distinct{1 <[RankingMKT.Ranking]={'1'}, [Market]={'$(=aggr([Market],[Workshop name]))'}> }[KPI.KPI_ANS])"*/
					"qExpr": "=$(FirstMKT_ANS)"
                  }
                },
                "gradient": false
              }
            ],
            "paletteColors": [
              {
                "color": "#004d99",
                "icon": "S",
                "index": -1
              },
              {
                "color": "#04912b",
                "icon": "R",
                "index": -1
              }
            ]
          }
        }
      },
	  "qCalcCondition": { /*"qCond": "=(not(isnull([KPI.KPI_ANS])) and not(isnull(concat({1 <[RankingMKT.Ranking]={'1'}, [Market]={'$(=aggr([Market],[Workshop name]))'}> }[KPI.KPI_ANS])))) and ([KPI.KPI_ANS] < concat({1 <[RankingMKT.Ranking]={'1'}, [Market]={'$(=aggr([Market],[Workshop name]))'}> }[KPI.KPI_ANS]))",*/ 
	  					  "qCond": "=$(Cond_FirstMKT_ANS)",
						  "qMsg": ""
	  } 
    },
	{
      "qDef": {
        "qLabelExpression": "upper(Label_First)",
        /*"qDef": "=concat(distinct{1 <[RankingMKT.Ranking]={'1'}, [Market]={'$(=aggr([Market],[Workshop name]))'}> }[KPI.KPI_ANS])",*/
		"qDef": "=$(FirstMKT_ANS)",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0.0%",
          "qDec": ".",
          "qThou": ","
        },
        "conditionalColoring": {
          "paletteSingleColor": {
            "index": -1,
            "color": "#5c5b5b"
          }
        }
      }
    }
	  ],
	  {
	  "showTitles": false,
	  "showMeasureTitle": false,
	  "textAlign": "center",
	  "fontSize": "L",
	}
	).then(function(vis){
	  vis.show("ANSBestMKT");
	});

 

I'm pretty sure this is an issue related to promise returned by the vis.show method but i can't get the solution.

thank you!

1 Reply
GabrielLima
Partner - Contributor III
Partner - Contributor III

When using mashups you must update your (external) objects.

Look:

 

GabrielLima_0-1655746884512.png