max_turrell
1st September 2015, 16:24
Hi,

I'm looking to add some additional logging to my Condition scripts within Exchange. My Conditions are attached to the Batch - Table Relations Import - Permitted Operations section. The intention being to prevent data from being imported that would not pass the std checks in the tables' related Baan Session e.g. qty checks in Item Ordering Data.

My individual Conditions my contain checks against 3 or 4 incoming fields. However the std logs only tell you that the incoming records have been skipped against the Condition name - not which field or check was the route cause/reason.

I have read that there is a predefined function called 'log.mess' that might be a possible option. But I cant find any further information out on this e.g. syntax or an example script.

Has anyone found a solution to this kind of problem (log.mess or otherwise)?

Thanks,

Mark.

max_turrell
15th September 2015, 18:43
The answer lies in the 'log.mess()' function. In here you can specify an existing message code as well as parameter driven information. When the function is triggered by the Exchange Condition, the message will appear on screen as well as in the Exchange Scheme's log.

Beware: if you are importing a large amount of transactions with a high rate of failure, you will see a lot of your new error message(s).

The quick guide to syntax is: log.mess(message code, [parameter] (optional), ...). For example: log.mess("tuxch0101", tcibd001.item, tcibd001.citg). The example shown is purely for illustration and assumes that the message code contains 2 '%s' symbols therefore expecting 2 string values to be imported ("Unable to import General Item Data for Item: %s, Item Group: %s").

mark_h
21st September 2015, 15:51
Thanks for posting the solution.