Displaying custom error messages after running a process in PAW

Ideas and tips for enhancing your TM1 application
Post Reply
luizg2019
Posts: 41
Joined: Thu Sep 12, 2019 11:02 pm
OLAP Product: TM1 - PAX-PAW-Perspectiv-Arc
Version: PA 2.0.9 - PAW 2.0.73
Excel Version: office 2016

Displaying custom error messages after running a process in PAW

Post by luizg2019 »

Hello, ever since Planning Analtics Workspace 2.0.43 when a process execution results in errors, the error log line is displayed directly in PAW. More info about this here.

EDIT 7/3/2022: Ever since PAW 62 this is only working for ADMIN users, apparently it was a bug before. :roll: Thanks Thanks Mark for following up with this

We can use this feature to display a custom error message directly in the PAW window using the ItemReject TI function, it will reject a source record and place it in the error log with a custom error message. The syntax is something like this:

Code: Select all

If (ErrorCondition=True);
   ItemReject ('Error Msg');
EndIf;
And the error will be displayed like this:

Image


Observations:

If you use ItemReject in the Prolog section, it will skip the rest of code under it and go straight to the epilog tab.
A good approach to this if you have code in your epilog tab is to use something like this:

Code: Select all

#PROLOG

If (ErrorCondition=True);
  vError=1;
  ProcessBreak;
EndIf;

#EPILOG

If (vError=1);
   ItemReject ('Error Msg');
EndIf;
If you have a metadata/data section, it will skip only a single record and process the rest. So it's a good idea to place a ProcessQuit function in the metadata and data sections.

Code: Select all

#PROLOG

If (ErrorCondition=True);
  vError=1;
  ItemReject ('Error Msg');
EndIf;

#METADATA and #DATA

If (vError=1);
   ProcessQuit;
EndIf;
Also there's seems to be a bug (I don't know if it's fixed in the latest versions of PAW or not, I already notified IBM about it) if you have the 'Language=something' parameter in your tm1s.cfg file, it won't show the log on the error messsage in PAW, but if you remove this setting and restart the server it should work.

Thanks!
Last edited by luizg2019 on Sun Jul 03, 2022 10:00 pm, edited 4 times in total.
lotsaram
MVP
Posts: 3651
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Displaying custom error messages after running a process in PAW

Post by lotsaram »

luizg2019 wrote: Sun Dec 06, 2020 9:01 pm If you have a metadata/data section, it will skip only a single record and process the rest. So it's a good idea to place a ProcessQuit function in the metadata and data sections.
Well actually there's a much better approach. In the condition where you ItemReject just convert the process on the fly to having no data source. The Metadata and Data tabs will then be skipped and the process will proceed straight to the Epilog.

E.g.

Code: Select all

If( some condition @= 'TRUE' );
    DatasourceType = 'NULL';
    ItemReject( 'Your custom error message here' );
EndIf;
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
luizg2019
Posts: 41
Joined: Thu Sep 12, 2019 11:02 pm
OLAP Product: TM1 - PAX-PAW-Perspectiv-Arc
Version: PA 2.0.9 - PAW 2.0.73
Excel Version: office 2016

Re: Displaying custom error messages after running a process in PAW

Post by luizg2019 »

lotsaram wrote: Mon Dec 07, 2020 8:49 am Well actually there's a much better approach. In the condition where you ItemReject just convert the process on the fly to having no data source. The Metadata and Data tabs will then be skipped and the process will proceed straight to the Epilog.

E.g.

Code: Select all

If( some condition @= 'TRUE' );
    DatasourceType = 'NULL';
    ItemReject( 'Your custom error message here' );
EndIf;
Wow, great idea!
Thanks.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Displaying custom error messages after running a process in PAW

Post by macsir »

Nice one, lotsaram!
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Mark RMBC
Community Contributor
Posts: 292
Joined: Tue Sep 06, 2016 7:55 am
OLAP Product: TM1
Version: 10.1.1
Excel Version: Excel 2010

Re: Displaying custom error messages after running a process in PAW

Post by Mark RMBC »

Hi,

Yes a very belated nice one from me too, except, as per the discussion below, the messages only display to Admin users.

https://www.tm1forum.com/viewtopic.php?p=79545#p79545

So really, about as useful as a chocolate fireguard!

regards,

Mark
Post Reply