Some issues with embedding TI processes

Finally dealing with TI processes on Canvas page, I was wondering if it was possible to trigger the process also by a link or some JavaScript call, rather than having a rendered into my page. E.g. having the chance to trigger a TI from each line of a table and feeding the table row’s context into the process would result in a intuitive way to modify certain things rather than having a single button somwhere else on the page that will ask for the parameters. But … I don’t want tons of buttons blowing up the layout of the table, instead I prefer a small icon or a link.

I noticed there are some tm1-ui-class and tm1-ui-button-class attributes that might lead to the desired result, but I’m caught in the tags. Right now, the classes do not seem to get applied, see resulting HTML below where the classes “asdf1” and “asdf2” are specified but not applied to the final HTML:


However, once I clicked the button the the process was triggered, the custom classes get assigned. But why not right from the beginning?

Another thing: a process run from the sheet updates data in a cube, which will affect the result of my active form. However, Setting the “tm1-refresh-page” to “true” does not update my active form. Any idea why? How can I force an active form (or also other parts of a page) to refresh via JavaScript, so I could use the callback JavaScript parameter to trigger that action after process execution.

Thanks a lot,
Andreas

Hi Andreas,

we built something similar recently!
We used a different approach though. We decided not to use tm1-ui-process directive directly, but call the TI Process from JS through the $tm1Ui service.
In the active Forms we have little clickable Icons at the end of the row. Here is how it looks (had to remove some data and headers).

This is how we did it:
The Icons are <i> tags. We gave them CSS classes so they get the Font Awesome look and the hover effect (this makes the users feel like the icons are clickable).
The <i> tag also needs the ng-click directive. In the expression of the ng-click we call a JS function, which is defined in the $scope.
When calling the JS function you can pass arguments from the scope of the row.

In the JS function we call the TI Process through the $tm1Ui service.

Is that kinda what you want to do?

Cheers,

Marius

1 Like

Hi @andreas.franke,

Regarding the button class, we will have a look at that. Can you contact you local Cubewise office so they can send a ticket to us regarding this? Thanks!

Then, in support of what @mwirtz has posted, yes there is a Javascript function you can use to do that. Check out the Help page on your Canvas application or in the samples and scroll down to:

When you click the above link, a help documentation regarding function calls you can do will appear on the right. Scroll to the service call:

An example call would be:


$tm1Ui.processExecute('dev', 'Bedrock.Server.SaveDataAll', 'pDebug', 1).then(function(result){
    if(result.success){
        // Process has run successfully. Do something else here...
    }
});

// or you can opt to not pass any parameter, which should then just use the default values declared on your TIs
$tm1Ui.processExecute('dev', 'Bedrock.Server.SaveDataAll').then(function(result){
    if(result.success){
        // Process has run successfully. Do something else here...
    }
});

Lastly, regarding the active form, by refresh, do you mean reset the active form into its original state? Or just refresh the values? Can you post your HTML code for your tm1-ui-process?

Cheers!


Paul

[/code]

Dear Paul,
dear Marius,

I implemented this form now using $tm1Ui.processExecute, as you recommended, and it works perfectly.
As I wrote before, when still using the tm1-ui-process directive with tm1-refresh-page="true", the active form was not refreshed after running the process. I there is a different meaning compared to my expectations: I expected kind of a “rebuild active form” because my process would affect the rows returned in the result. However, I think this attribute would just refresh the values currently shown in the form - so in my case no difference.

No after switching to $tm1Ui.processExecute, how would I force the active form to completely rebuild so that removed or added result lines will disappear or show up? I tried $scope.data.pageUpdate() and $scope.data.recalculate(), but this doesn’t seem to be the right one.

Update: sorry, forget my last question. It has to be $tm1Ui.dataRefresh() just found it in the $tm1Ui documentation.

Thanks a lot,
Andreas

1 Like

As a temporary solution you can try to have two active forms on a page and switching them using ng-if=‘someScopeVariable’ condition. You can include a function which run after your process has been executed. In this function just switch $scope.someScopeVariable =! $scope.someScopeVariable;. Don’t forget define this variable as false or true in your controler.