<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to use a field as label creating KPI on the fly? in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-use-a-field-as-label-creating-KPI-on-the-fly/m-p/1809040#M14970</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I can't find a solution to the problem I'm facing. I used visualization API to create the KPI object on the fly in my mashup.&lt;/P&gt;&lt;P&gt;Now I want to use values contained in a specific field "Label_Europe" to let the labels of the object to change language based on the Market selected in mashup. While in sense application I can use this field to obtain the correct result, I can't get same result in mashup object. Please watch at my code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;app.visualization.create( 
	'kpi',
	  [
		{
      "qDef": {
        "qLabel": "=Label_Europe",
        "qDef": "RankingEU.Ranking",
        "qNumFormat": {
		"qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0°",
          "qDec": ".",
          "qThou": ","
          
        },
		"conditionalColoring": {
          "useConditionalColoring": true,
          "segments": {
            "limits": [
              {
                "value": {
                  "qValueExpression": {
                    "qExpr": "RankingEU_Prev.Ranking-0.001"
                  }
                },
                "gradient": false
              },
			  {
                "value": {
                  "qValueExpression": {
                    "qExpr": "RankingEU_Prev.Ranking+0.001"
                  }
                },
                "gradient": false
              }
            ],
            "paletteColors": [
              {
                "color": "#04912b",
                "icon": "R",
                "index": -1
              },
			  {
                "color": "#fc9003",
                "icon": "T",
                "index": -1
              },
              {
                "color": "#db1f12",
                "icon": "S",
                "index": -1
              }
            ]
          }
        }
      }
    },
	{
      "qDef": {
        "qLabel": "PREV",
        "qDef": "RankingEU_Prev.Ranking",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0°",
          "qDec": ".",
          "qThou": ","
        },
        "conditionalColoring": {
          "paletteSingleColor": {
            "index": -1,
            "color": "#5c5b5b"
          }
        }
      }
    }
	  ],
	  {
	  "showTitles": false,
	  "showMeasureTitle": true,
	  "textAlign": "center",
	  "fontSize": "L"
	}
	).then(function(vis){
	  vis.show("EU_rank");//Europe ranking
	});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see I used the field "Label_Europe" to populate the "qlabel"&amp;nbsp; as "qLabel": "=Label_Europe" but we I open my mashup this is what I see:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="KPI.jpg" style="width: 495px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/55272i2B3D0688CB21C5C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="KPI.jpg" alt="KPI.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that using double quote in the code to indicate the field is a wrong approch because the engine interprets as string what is included in double quote. There should be a way to let engine to read the "=Label_Europe" as an expression, but I don't know how!!&lt;/P&gt;&lt;P&gt;Can someone help me please?&lt;/P&gt;&lt;P&gt;thank you All for the support&lt;/P&gt;&lt;P&gt;Federico&lt;/P&gt;</description>
    <pubDate>Wed, 19 May 2021 13:07:33 GMT</pubDate>
    <dc:creator>kikko</dc:creator>
    <dc:date>2021-05-19T13:07:33Z</dc:date>
    <item>
      <title>How to use a field as label creating KPI on the fly?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-use-a-field-as-label-creating-KPI-on-the-fly/m-p/1809040#M14970</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I can't find a solution to the problem I'm facing. I used visualization API to create the KPI object on the fly in my mashup.&lt;/P&gt;&lt;P&gt;Now I want to use values contained in a specific field "Label_Europe" to let the labels of the object to change language based on the Market selected in mashup. While in sense application I can use this field to obtain the correct result, I can't get same result in mashup object. Please watch at my code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;app.visualization.create( 
	'kpi',
	  [
		{
      "qDef": {
        "qLabel": "=Label_Europe",
        "qDef": "RankingEU.Ranking",
        "qNumFormat": {
		"qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0°",
          "qDec": ".",
          "qThou": ","
          
        },
		"conditionalColoring": {
          "useConditionalColoring": true,
          "segments": {
            "limits": [
              {
                "value": {
                  "qValueExpression": {
                    "qExpr": "RankingEU_Prev.Ranking-0.001"
                  }
                },
                "gradient": false
              },
			  {
                "value": {
                  "qValueExpression": {
                    "qExpr": "RankingEU_Prev.Ranking+0.001"
                  }
                },
                "gradient": false
              }
            ],
            "paletteColors": [
              {
                "color": "#04912b",
                "icon": "R",
                "index": -1
              },
			  {
                "color": "#fc9003",
                "icon": "T",
                "index": -1
              },
              {
                "color": "#db1f12",
                "icon": "S",
                "index": -1
              }
            ]
          }
        }
      }
    },
	{
      "qDef": {
        "qLabel": "PREV",
        "qDef": "RankingEU_Prev.Ranking",
        "qNumFormat": {
          "qType": "F",
          "qnDec": 2,
          "qUseThou": 0,
          "qFmt": "0°",
          "qDec": ".",
          "qThou": ","
        },
        "conditionalColoring": {
          "paletteSingleColor": {
            "index": -1,
            "color": "#5c5b5b"
          }
        }
      }
    }
	  ],
	  {
	  "showTitles": false,
	  "showMeasureTitle": true,
	  "textAlign": "center",
	  "fontSize": "L"
	}
	).then(function(vis){
	  vis.show("EU_rank");//Europe ranking
	});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see I used the field "Label_Europe" to populate the "qlabel"&amp;nbsp; as "qLabel": "=Label_Europe" but we I open my mashup this is what I see:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="KPI.jpg" style="width: 495px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/55272i2B3D0688CB21C5C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="KPI.jpg" alt="KPI.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that using double quote in the code to indicate the field is a wrong approch because the engine interprets as string what is included in double quote. There should be a way to let engine to read the "=Label_Europe" as an expression, but I don't know how!!&lt;/P&gt;&lt;P&gt;Can someone help me please?&lt;/P&gt;&lt;P&gt;thank you All for the support&lt;/P&gt;&lt;P&gt;Federico&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 13:07:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-use-a-field-as-label-creating-KPI-on-the-fly/m-p/1809040#M14970</guid>
      <dc:creator>kikko</dc:creator>
      <dc:date>2021-05-19T13:07:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a field as label creating KPI on the fly?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-use-a-field-as-label-creating-KPI-on-the-fly/m-p/1809778#M14986</link>
      <description>&lt;P&gt;Ok just solved my issue by my self!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As you can see I was using the code below&amp;nbsp;to define the label of my KPI object.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"qLabel": "=Label_Europe",&lt;/LI-CODE&gt;&lt;P&gt;But "qlabel" can be used only for static (not calculated) labels. After hours of&amp;nbsp; Sense manual surfing I have found the solution.&lt;/P&gt;&lt;P&gt;Instead of using&amp;nbsp;"qlabel" you just want to use&amp;nbsp;"qLabelExpression".&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"qLabelExpression":"Label_Europe",&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in this way the engine is able to interpret the argument "Label_Europe" as a field extracting the value from the field based on applied filters and then you can show a variable/dynamic Label.&lt;/P&gt;&lt;P&gt;So thank you to my myself!! I'm proud of me!!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 13:51:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/How-to-use-a-field-as-label-creating-KPI-on-the-fly/m-p/1809778#M14986</guid>
      <dc:creator>kikko</dc:creator>
      <dc:date>2021-05-21T13:51:24Z</dc:date>
    </item>
  </channel>
</rss>

