Does $tm1UiTable.create work with $tm1UI.dimensionElements() array?

I had a need to pull in parents of an element list I was using as rows in the Canvas Table. So instead of using tm1-ui-element-list, I pulled the rows array via the dimensionElements method which has a parent flag. The array returned though is not in the same format and is missing several properties that the tm1-ui-element-list has. Because of this I could not get it to work with create table method. Is there a way I can convert it to the format the table create method expects?

Thanks,
Chet

Hi @chet_watkins,

You can use tm1-ui-element list with $tm1UiTable.create but you must first initialize the array in the controller before the $tm1UiTable.create call: $scope.arrayName = []

In JavaScript and particular in Angular if you want an array to be reused you create it once and then clear it like this $scope.arrayName.length = 0. If you clear it with $scope.arrayName = [] a new reference is created and Angular can’t track the changes.

Thanks for the reply. I might not have stated it correctly, but I am able to use tm1-ui-element-list with the $tm1uiTable.create. I was trying to use the array created from the $tm1UI.dimensionElements() method in the controller since I am using it to get parents of the same subset and it would be redundant to make the call twice. When I try to use the array created from the dimensionElements() method, the $tm1UiTable.create does not work. I believe it is because the array created from the tm1-ui-element-list has a key and alias property where the $tm1UI.dimensionElements() method does not. My question is really two fold. Am I missing something? Should it work? If it should not, why? Could they not make the arrays returned from each be compatible with the $tm1UiTable.create method?

Thanks,
Chet

Hi @chet_watkins,

To clarify, do you just need the parents of a set of elements and display those? Am I correct to say that you were trying to display elements excluding leafs?

If so, perhaps just via Subset, with TM1DRILLDOWNMEMBER and TM1FILTERBYLEVEL might be sufficient already. Then you can just use the tm1-ui-element-list and the tm1UiTable.create() directly.

This service was originally meant for use with what tm1-ui-element-list’ output.


Paul

I guess I just made the assumption that since both return an array of elements, they would have the same properties (or at least the same for use with the tm1uiTable.create()) and be interchangeable. If that is not the case, it is not an issue and I can work around it. I just wanted to make sure I was not missing something obvious. Thank you for the replies.