$tm1Ui.cellGet use ng-model

Hi all

I have a $tm1Ui.cellGet to get certain cell value in TM1.
When i replaced an element name with an ng-model name, the code stops working.
Does it mean $tm1Ui.cellGet doesn’t support variable?

This is how i used it:

in html: ng-model="example";
in js: $tm1Ui.cellGet('instanceName', 'cubeName', 'Ele1', 'Ele2', $scope.example);

Thanks
Tina

Hi Tina,

the cellGet function certainly accepts variables.

My assumption would be that the initialization of $scope.example in the HTML doesn’t work as expected.
Did you check if $scope.example actually has a value through {{example}} in the HTML ?

Cheers,

Marius

Hi @twu,

Note that the controller (js) loads first before the html.

So the case above, if you are trying to execute the cellget without any interaction or button from the HTML page, then the above will not work.

Otherwise, as @mwirtz has mentioned, check if your example variable has a value.


Paul

Hi @plim

Is there any way to tell the cellGet to wait till this variable has value?

Hi @twu,

There are ways, but how you initialize that variable may already give you that. Where are are you using this? In a directive? Can you post the HTML code on how you initialize this on your HTML page?


Paul

Hi @plim

I am using it in a SUBNM:

  <tm1-ui-subnm
    tm1-instance="FileUpload"
    tm1-dimension="Sys Upload Specification"
    tm1-subset="AllModules"
    tm1-change="setModule(data)"
    tm1-default-element={{filterSelected}}
    ng-model="moduleSelected"
    >
  </tm1-ui-subnm>

Hi @twu,

One way is to just update the setModule(data) function, and add a call to your cellGet. That way, you will be assured that it gets called when the value is available.

If you want it to be called once time only, you can create a flag, or a counter so that it only gets once.


Paul

Thanks! adding to setModule(data) works.