Page 1 of 1

Displaying custom error messages after running a process in PAW

Posted: Sun Dec 06, 2020 9:01 pm
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!

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

Posted: Mon Dec 07, 2020 8:49 am
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;

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

Posted: Wed Dec 09, 2020 11:22 am
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.

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

Posted: Thu Mar 24, 2022 10:59 pm
by macsir
Nice one, lotsaram!

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

Posted: Fri Mar 25, 2022 9:59 am
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