Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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