Is there a way to make the default value for TM1-ui-subnm dynamic. Maybe with a tm1-ui-dbr-read-only or something.
Looking at getting the current reporting month from a cube so the report always defaults to the correct month.
Brian
Is there a way to make the default value for TM1-ui-subnm dynamic. Maybe with a tm1-ui-dbr-read-only or something.
Looking at getting the current reporting month from a cube so the report always defaults to the correct month.
Brian
Hi @bknott,
The tm1-default-element of the tm1-ui-subnm should be able to help you out on this one.
Just note that it should be an element name, not an alias.
–
Paul
Was using tm1-default-element but with a static element. I want to change it to a value from a cube. Managed to do it by using tm1-ui.cellget in the controller. Code is below.
Controller
$scope.default = {};
$tm1Ui.cellGet('Wesfarmers_prod', 'sys_control','actual_month','str').then(function(returnedData){
$scope.default.month = returnedData.Value.substring(0,3);
$scope.default.month = $scope.default.month.toLowerCase();
console.log($scope.default.month);
});
HTML Page
<tm1-ui-subnm
tm1-instance="Wesfarmers_Prod"
tm1-dimension="Month"
tm1-default-element="{{default.month}}"
tm1-subset="Canvas-Months"
tm1-attribute="DESC"
ng-model="selections.month" >
</tm1-ui-subnm>
Brian
Nice one @bknott,
An other way to do it would be to use first tm1-ui-dbr-read-only to get the value and hide this value using div ng-hide=“true”
<div ng-hide="true">
<tm1-ui-dbr-read-only tm1-instance="dev"
tm1-cube="System Info"
tm1-elements="Financial Month, String"
ng-model="page.month"></tm1-ui-dbr-read-only>
</div>
And then use tm1-default-element="{{page.month}}" in your SUBNM:
<tm1-ui-subnm
tm1-instance="dev"
tm1-dimension="Period"
tm1-subset="Default"
tm1-default-element="{{page.month}}"
ng-model="page.period"
>
</tm1-ui-subnm>