Please be careful when you are doing this, I assume you already know what you are doing.
But yes off course, you can bypass DAL in your program. The below piece of code will do it all for you, this will prevent all the DAL checks on the main table for the session.
I wouldn’t recommend bypassing DAL at all, its good to have it on. But if you have some customization where you can’t avoid it, you can’t avoid it.
It is always a good practice to maintain labels instead of simply typing the descriptions on the static forms/report layouts. You can understand the importance of the labels when you are working in multilingual environment.
Many a times there is need to retrieve the description maintained for a label code. You can easily achieve this with a predefined function “tt.label.desc()”
void tt.label.desc( string label_code(19), long label_context, ref string desc() mb )
This returns information of the specified label.
label_code : The label code, including the package code.
label_context : The label’s context.
The possible values are:
•1 General Use (for labels on forms and reports)
•2 Session, Table or Report Descriptions
•3 Enumerate descriptions
•4 Index descriptions
•5 Chart descriptions
•6 Menu and menu field descriptions
•7 Chart Application Option descriptions
•8 Business Object descriptions
•9 Subfunction descriptions
•10 Form Command descriptions
•11 Descriptions for External Use
•12 Cascading item on button descriptions
desc : This returns the longest description (in the user’s current language) of the specified label.
How to highlight fields in Baan reports programmatically?
Lot of times, there is a requirement to conditionally underline / bold / bold&underline a specific report field. This can be achieved very easily in BaaN using the function cf$()
string cf$( long attribute_code )
This pre-defined function is used to send a control code to the current window or printer. All characters after the command are printed or displayed in the font associated with the control code. To reset the font to normal, call
Some of the commonly used codes are
|9||bold & underlined||bold & underlined|
Lets take an example which will make the usage more clear
eg. Make the project bold & underlined if the project is not active.
In the code snippet below, note that domain “tccprj” not used, instead “tcmcs.str8” is used.Assuming the environment is BaaN IV, the domain length for project is 6, unlike 9 in LN.The domain used for the variable is of length 8. This is to accomodate 2 more characters for making the project appear bold & underlined in the report and to avoid truncation of characters.
domain tcmcs.str8 r.cprj |* Assuming the field will be printed in detail layout detail.1: before.layout: if not PROJECT.ACTIVE then r.cprj = cf$(9) & PROJECT & cf$(0) else r.cprj = PROJECT endif
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