Access elements in tm1-ui-element-list by key instead of index?

Hi,

I just ran into the situation where I need to lookup additional dimension attributes from within an ActiveForm. Unfortunately, the ActiveForm only allows me to specify one(!) attribute which will be used for display purposes. However, during my ng-repeat I would like to lookup additional attributes for each row element from a tm1-ui-element-list model (rather than firing a separate DBRA …).

How would you approach that? tm1-ui-element-list returns a string array, where I cannot access the elements by key directly. I could generate an object array out of the element list ng-model, but if I can avoid that, I would do so.

Or am I thinking too complicated here?

Thanks,
Andreas

Hi @andreas.franke,

There could be a number of approaches. Just would like to add that the DBRAs are batched similar to DBRs.

How many additional attributes need to be retrieved? You may want to check first with DBRAs and check the performance of the page.

If you need to reprocess the array and turn it into an object, perhaps using the $tm1Ui’s dimensionElements() function will be of better use since you are already doing some JS scripts on going back and fort between the tm1-ui-element-list, then converting the result into an object.

You can then set a flag which will only activate the Active Form when the processing for your dimension list has finished.


Paul

You could do something like this

var mdx = '{TM1SUBSETALL( [Version] )}';
$scope.versions = {};
$tm1Ui.dimensionElements('dev', 'Version', { mdx: mdx }).then(function (d) {
    for (var i = 0; i < d.length; i++) {
        $scope.versions[d[i].Name] = d[i];
    }
});

Then version elements can be accessed by their principal names on html page

{{versions['Actual']}}

Dear Paul,
dear aeremenko,

thanks for your suggestions, I think I’ll go for the JS approach as I need to lookup attributes several times from different places, so it’s worth to prepare them once for the whole page (actually several pagesI) in advance.

It could be an improvement for the future to provide the ng-model result of a tm1-ui-element-list as JSON-like object, to allow both the access by key and index.

Have a nice day,
Andreas

Hi @andreas.franke,

Thanks for the suggestion!

Can you please contact your Cubewise Local office for them to be able to assist you in creating a request for enhancement ticket on this.

Cheers!


Paul

Thanks Paul, I opened a ticket 2662. So let’s see. Andreas