Thanks Andrey,
That makes it log correctly, but I’m using the value in an “if” later and it still uses the old value
if ($scope.page.tenYears === "Y") {
$scope.mdx = {
So I have something like this (you may recognise some of this):
$scope.getYears = function () {
$tm1Ui.cellGet('dev', 'Details',$rootScope.$stateParams.costing,$rootScope.$stateParams.version,'Display Financial Year').then(function(data){
$scope.page.mdxYear1 = data.Value;
....
})
$tm1Ui.cellGet('dev', 'Details',$rootScope.$stateParams.costing,$rootScope.$stateParams.version,'10 Year Costing').then(function(data){
$scope.page.tenYears = data.Value;
console.log($scope.page.tenYears)
};
$scope.getData = function () {
$scope.getYears();
if ($scope.page.tenYears === "Y") {
$scope.mdx = {
...
}
} else {
$scope.mdx = {
...
}
}
$tm1Ui.cubeExecuteMdx('dev', $scope.mdx.default).then(function (result) {
$scope.dataset = $tm1Ui.resultsetTransform("dev", "Volumes Effort", result);
console.log($scope.dataset)
});
})
};
When I do the if ($scope.page.tenYears === “Y”) it needs to be run twice to see the updated value