How To #1 – Call a Report Layout Programmatically #baanhowto
Tweeted a month back, to start a howto section for Baan ERP on my blog.Well starting it from today.I Would like to make this section totally interactive, you can submit your #howtos using the quick submit form below in the post or from submit howto page, and you can also correct me, or add your inputs to the howtos answered by me, in the comment section below. Howtos are mainly for those who are new to Baan, bringing more awareness of wide capabilities, Baan Tools can provide. Love the way Baan Tools is designed. While tweeting any howto post, please use #baanhowto, to make the information available under a single hash tag. Starting with the first howto.
How to call a Report Layout Programmatically ?
Many a times, there is a requirement to call a particular report layout, conditionally after another layout. For example, you need After.Field layout to get printed, after every 5 records in Detail layout are printed. How will you do that ? In normal scenario, After.Field will get executed after all the records in Detail layout are printed.But in this scenario, we need to call the After.Field layout before all the records are printed and execution of Details layout is complete.
This can be achieved simply as shown in code snippet below
cnt = cnt + 1
if cnt > 5 then
cnt = 0
You can notice the function r.5.s.after.tdXXXXXX.YYYY() called in the before.layout of Detail.1. This function is a auto-generated function. When you compile your Report, Report Generator internally generates a script, defining the Report structure and Report flow based on the what you have maintained in the UI (Layouts maintained, Fields maintained in the Report Editor etc.). If you have two detail layouts say “detail.1” & “detail.2”, the auto-generated script will have the two layouts defined in functions “r.1.s.detail()” & “r.2.s.detail()” respectively. Similarly every layout maintained by you will have a respective function defined in the auto-generated script, which you can call in your Report script.
The image below provides the visual representation of the function’s naming convention.
stay tuned for more howtos, submit your howtos