Skip to main content
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
Showing results for 
Search instead for 
Did you mean: 

Need Help with Calculated Expression Evaluation in Qlik Sense Mashup


I'm working on a Qlik Sense mashup application with AngularJS, and I'm facing a challenge related to calculated expression evaluation. I have a scenario where I want to calculate the count of distinct clients based on a certain expression. Before performing an action, I need to evaluate the client count and take different actions based on the result.

Here's a simplified version of what I'm trying to achieve:

I have a button in my mashup application that triggers a filtering action using a calculated expression. Before applying the filter, I want to calculate the count of distinct clients using an expression. If the calculated client count is above a certain threshold (let's say 20,000), I'd like to display a pop-up message to the user indicating that they need to select a smaller number of clients. If the client count is below the threshold, I want to proceed with the filtering action.

I've attempted to use the createGenericObject method to evaluate the expression and retrieve the client count, but I've encountered challenges in getting the actual calculated value from the response.

Here's my current js code:

$scope.customerFilter = function(expression) {
var clientCountExpression = "=count(distinct Clients)";{
clientCount: {
qValueExpression: clientCountExpression,
}, function(reply) {
var clientCount = reply.clientCount.qValue.qNum;
console.log("Client count:"+clientCount);
if (clientCount > 1000) {
// Display a pop-up message indicating that there are too many clients
alert("Please select a smaller number of clients.");
} else {
//Filter clients"vNameClient", function(fieldName) {
var field =;
field.selectMatch(expression).then(function() {
console.log("Filtering done");


This is not returning the first console.log.

I would greatly appreciate any guidance or suggestions. Thank you in advance for your help and insights.

Best regards,

Labels (1)
0 Replies