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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Marcio
Partner - Contributor II
Partner - Contributor II

toogle button Switch On/Of

Hi, 

I get extention Switch On/Off, but i have a problema when i change application, because i can't take variable value, the value it's always the same.

controller: ["$scope", function($scope) {
function stringToBoolean(string) {
switch (string.toLowerCase()) {
case "true":
case "yes":
case "1":
return !0;
case "false":
case "no":
case "0":
case null:
return !1;
default:
return Boolean(string)
}
}
var app = qlik.currApp(),
varName = $scope.layout.props.varName;


 

var init = function(numTries) {
numTries || (numTries = 0), numTries > 2 || (numTries > 0 && angular.noop(),

------When arrive here, the variable value always 0.-------
app.variable.getContent(varName).then(function(reply) {
$scope.isSelected = stringToBoolean(reply.qContent.qString)
})["catch"](function(error) {
numTries++, init(numTries)
}))
};

Tks for any help!

Labels (1)
0 Replies