Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
goos_it
Contributor II
Contributor II

Master measure extension number format with % not working

Hey, Guys,

I´m trying to have a master measure created via extension. I want the number format to be the standard format with format string "0,00%" (german layout), but it doesn´t work. I´m always getting a master measure with an empty number format string (correctly labeled as "Number" German: Zahl).

goos_it_0-1668155887581.png

 

My parameters are:

 "qNumFormat": {
"qType": F,
"qnDec": 2,
"qUseThou": 0,
"qFmt": 0,00%,
"qDec": , ,
"qThou": .
}
I´m sure it has something to do with the qFmt, but no matter how many single or double quotes i use, it still won´t accept it.

If i do the same with the money format, It works (meaning it shows my format string an the number type money.

How can I get qlik to give this measure the standard format for  a %-number (I know there is a way to make it a user-defined format which ignores the given standard formats and uses the format string, but this isn´t what I want to achieve because it will erase the qlik-functionality of interpreting a number 0.1 as 10% (with a full custom number format it will give me 0.1%...).

Thanks for all your suggestions and thoughts!

Br Stephan

 

var properties = {
                    "qInfo": {
                        "qType": "measure",
                        "qId": measureId
                    },
                    "qMeasure": {
                        "qLabel": label,
                        "qDef": expression,
                        "qGrouping": "N",
                        "qLabelExpression": labelExpression,
                        "qExpressions": [],
                        "coloring": {
                            "baseColor": {
                                "color": color,
                                "index": -1
                            },
                            "gradient": segmentColor 
                        },
                        "qActiveExpression": 0,
			"qNumFormat": {
				"qType": formatType,
				"qnDec": parseInt(formatNDec),
				"qUseThou": parseInt(formatUseThou),
				"qFmt": formatFmt,
				"qDec": formatDec,
				"qThou": formatThou
				}
                    },
                    "qMetaDef": {
                        "title": cells[0].qText,
                        "description": description, 
                        "tags": tagsList, 
                    }
                };

 

Labels (2)
1 Reply
alex_colombo
Employee
Employee

Hi @goos_it , try to use this for creating your master measure. It will create a new master measure with your format

{
        "qInfo": {
            "qType": "measure",
            "qId": "ZRPVLb"
        },
        "qMetaDef": {
            "title": "Test Format 2",
            "description": "",
            "tags": []
        },
        "qMeasure": {
            "qLabel": "Test Format 2",
            "qDef": "sum(Expression2)",
            "qLabelExpression": "",
            "isCustomFormatted": false,
            "qNumFormat": {
                "qType": "F",
                "qnDec": 2,
                "qDec": ",",
                "qThou": ".",
                "qFmt": "0,00%"
            },
            "coloring": {}
        }
    }

 

This is what I have after I created the master measure with engine API

alex_colombo_0-1669129692629.png