How to use DBS / CellPutN fro Canvas

I would like to know if somebody have used or know how to use an equivalent functionality for DBS / CellPutN / CellGetS with Canvas or could give me idea how to use them ?

thanks in advance.

Hi tganz,

We don’t have a CellPutN but we have cellPut and cellPuts. The first one updates a single cell and the second multiple cells. cellPutS is actually going to be renamed to cellsetPut to make its use clearer.

To use cellPut do the following:

$tm1Ui.cellPut(1200.56, "instance", "cube", "Element1", "Element2").then(function(result){
  // Handle result
  if(result.success){
    // It worked!!
  }
});

For a string value you should pass through a string to the save function

$tm1Ui.cellPut("a string", "instance", "cube", "Element1", "Element2").then(function(result){
  // Handle result
  if(result.success){
    // It worked!!
  }
});

thanks a lot Tim,

That’s works perfectly !

Hey,

If I wanted to use the above, but with values from another ng-model, how would i do that:

$tm1Ui.cellPut(**ngmodel2.key**, "instance", "cube", **ngmodel1.key**, "Element2").then(function(result){
  // Handle result
  if(result.success){
    // It worked!!
  }
});

Would i need to set up a watch or if the canvas tag that i’m deriving value from is already watched would it work without?

Thanks

Jack

Hi @jtuckerman,

It should be something like:

$tm1Ui.cellPut($scope.ngmodel2.key, "instance", "cube", $scope.ngmodel1.key, "Element2").then(function(result){
  // Handle result
  if(result.success){
    // It worked!!
  }
});

The watch is only if you wanted to do something when a model’s value changes.

One of the key things to remember on using models in controllers is should be accessed through $scope.


Paul

Hey Paul,

I think that’s possibly the problem that I’m having.

I’ve an ng-model via in the HTML called page.storedaccount, and the following in my JS:

$scope.page = {
storeaccount: []
};

$tm1Ui.cellPut($scope.page.storeaccount.key, …and so on.

But it doesn’t write a value to my cube, I’m guessing because the ng-model isn’t populated when the above executes?

Jack

Hi @jtuckerman,

Check the values when you click on the function that is supposed to be executed on that update.

To do this, put a code --> debugger; a line before that cellPut. Open up your Chrome Developer Console, before executing that code / click from the front end.

debugger;
$tm1Ui.cellPut($scope.ngmodel2.key, "instance", "cube", $scope.ngmodel1.key, "Element2").then(function(result){
          // Handle result
          if(result.success){
            // It worked!!
          }
        });

Chrome will stop at the debugger line. When this happens, hover over the variables, you will see the values at that point.

This should give you and idea on what is going on your script.

Also, after the cellPut has executed, on your Network tab, check if there is any request at the bottom that has DBS in its URL.


Paul