How call bat file from Planning Analytics

Product:
Planning Analytics 2.0.9.19 or newer
Microsoft Windows 2019 server

Issue:
How call a cmd/bat file without use the Executecommand, that is not around in the next version?

 

Solution:

In TM1 version 11 you can use ExecuteCommand(CommandLine, Wait)​;   https://www.wimgielis.com/tm1_executetempbatchfile_EN.htm 

In future version you have to do something else, probably you need to run some external schedule program that talk REST API to tm1 servers, like TM1Py (cubewise.com)  .. and then monitor the TM1 REST API to know when other external program should start.

From a external python script can you send email and start a TM1 TI process (with REST API) , but how do you activate them from inside TM1 TI without use of the ExecuteCommand?

Only option is ExecuteHttpRequest, described below: (but that means that the other application must have a REST API support)

This function executes an HTTP request. It supports HTTP methods GET, POST, PATCH, PUT and DELETE.

The HTTP response is cached in memory. A response consists of a status code, a number of headers and a body, any of which can be queried by using the corresponding TurboIntegrator functions: HttpResponseGetStatusCode, HttpResponseGetHeader, and HttpResponseGetBody.

The Planning Analytics Engine only keeps one HTTP response at a time. A new successful HTTP request execution update and overwrites the cached response.

The Planning Analytics Engine only keeps the first 100 KB of a response body and discards the rest. This prevents running out of evaluation memory for strings.

For convenience, the engine reuses the cookie it found in the previous responses in new requests when the Cookie header is absent.

Syntax

ExecuteHttpRequest(method, URL, option1, option2,
...);

Argument

Description

method The method of the HTTP request. Supported methods are
URL The URL where you want to execute the request. The URL must use the HTTP or HTTPS protocol.
option1, option2, … You can use these options in the request:

-u user
The basic user credential
-h header
The request header. A request can have multiple headers.
-d body
The request body. When started with an @ character, the body will be read from the file having the name found following the @ character.
-o filename
The file to which the response is written.
-c certificate_file
A custom CA certificate file.
-k
Instructs the server to not verify the TLS certificates.

https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=functions-executehttprequest

It may exist in some version of TM1.  Unclear in the IBM documentation.  Below links about Tm1 Rest Api

 

 

More Information:

https://www.ykud.com/blog/pa11-executehttprequest/ 

  • ExecuteCommand is going away in v12 (no interaction with OS in containers) so any external interaction (e.g. emails) will need another way to talk to something
  • TM1RunTI will not work in v12 either (as well as anything else using C API) and would leave a gap in PA orchestration capability, requiring some external tool to connect 2 PA databases. ExecuteHttpRequest would allow using TM1 Rest Api to achieve the same functionality

TM1/PA REST API Part 1: Introduction – Getting it Right

https://exploringtm1.com/managing-applications-command-line/ 

Send email/attachments | BIhints

Sending Email from IBM Cognos TM1 using Windows Powershell – Clear Insight | Total Performance Management

Using PowerShell in IBM Planning Analytics (aramar.co.uk)

Planning Analytics on Cloud – SMTP (send email) process using Powershell script (ibm.com)

How to use the Synchronize Function with RunProcess to Limit the Number of Threads (cubewise.com)

https://code.cubewise.com/blog/mastering-the-tm1-rest-api-with-postman/

https://github.com/Hubert-Heijkers/tm1-restapi-lab-dev-env-setup/blob/master/files/HOL-TM1SDK/postman_collections/TM1%20REST%20API.postman_collection.json

https://healthchecks.io/

https://www.febooti.com/products/automation-workshop/

https://n8n.io/integrations/

But does it exist a scheduler that talk REST API?   Power Automate can run Python or PowerShell code where you can write REST API (but Power Automate run IronPython version 2.7 or 3.4, that does not work well with latest tm1py).

https://learn.microsoft.com/en-us/power-automate/desktop-flows/requirements#sign-in-account-comparison

https://www.visualcron.com/comparelicenses.aspx#tasks

https://succeedium.com/teamone/

https://community.ibm.com/community/user/businessanalytics/blogs/vlad-didenko/2022/03/30/teamone-run-tm1-process-from-google-sheets

https://ironpython.net/blog/2014/12/07/pip-in-ironpython-275.html