manusatsangi
20th February 2003, 15:34
Hi,
I have a report in which an input field (called 'level') is 'presorted' and a typical sequence of this numeric field can be :
1, 2, 3, 2, 3, 4, 5, 2, etc.....
Now I have a requirement to print a particular layout when
1) the sort sequence of the input field break
and also when
2) the new (upcoming) value is less than the current value of the field.
i.e. when both the conditions are met.
Now if I use a layout 'after.level.1', then it does not check for the 2nd condition at all.
How do I arrange so that this layout is printed only when both the conditions are met.
Warm Regards
Manu
mark_h
20th February 2003, 20:05
In the after field layout you can read the r.recbuf$ to get the next value. r.recbuf$ is the variable in the report that baan uses to hold the record, this is then translated into the layout fields. Here is an example:
declaration:
extern domain tppdm.gcid.a some.gcid
after.tpppc600.gcid.1:
after.layout:
e = string.scan(r.recbuf$,"%s^B",some.gcid) | Return the fields
if some.gcid<tpppc600.gcid then
lattr.print = false
endif
Run the report in debugger and look at the string.scan it uses to read in the fields. Then just clone this into the after.layout field. Remember to use different variables than the report fields so they do not get confused.
Mark
manusatsangi
21st February 2003, 08:14
Hi Mark,
Thanks for the reply.
But unfortunately, when pasted your script with relevant modifications and tried to compile the report, it did not compile and complained that :
r.recbuf$ not declared
I thought, maybe the variable name would be similar in nature like r.recbuf1$, r.recbuf2$.. as usually rep_gen creates variable names depending upon the report.
So, I just added a dummy line as given below:
declaration:
long new.level
after.level.1:
after.layout:
message("Hi")
Now I debugged the report script and created a breakpoint on the 'message("Hi")' line.
On hitting the break point, I listed all the variables in the debugger using 'l' and also 'L'.
I went on searching for variables with were similar to 'r.recbuf$'. BUt alas, I found none.
There is another way I tried to search,
I altered the program script (just for this research) so that it first sends records with level = 78 then with level = 79. Hence when this breakpoint is hit, the value of level is changing from 78 to 79.
So, I went on searching variables which have value 79.
Because it is this value 79, which I have to know beforehand, while printing 78. BUt I found no variable containing value 79. :(
Do you have any idea about this, why is it not working with me when it is working for you?
Any tools version mismatch?
I am on Baan IV c4. Porting set 6.1c.06.02.
Tools version 6.1
Warm Regards
Manu
mark_h
21st February 2003, 15:57
I am not sure about 4c4 since I do not have access to it yet, but under 4c3 when the report is in debug mode I can go to the top and see where r.recbuf$ is declared. Is there a section in debug mode called r.read.seq.file()? This is where the data is read into the report and where I got r.recbuf$ variable. I put two different reports in debug mode and saw where this variable is consistent. In my case I could see where in did the r.read.seq.file() then did if changed(tpppc600.gcid) check and then did the after section layout. I attached a document showing those sections.
Mark
manusatsangi
24th February 2003, 07:35
Hi Mark,
Thanks a lot for the detailed info.
I noticed that if I do not have a sorting of "Ascending" or "Descending" in my report input fields, the function r.read.seq.file() as blank. And hence r.recbuf$ are not declated etc.
The moment, I create a "dummy" report input field (with Ascending), it declares r.recbuf$ and writes some code in r.read.seq.file().
Earlier, I was using a report in which fields were either "Presorted" or "None", hence r.recbuf$ was not getting declared.
Anyway, I have made a workaround by giving a "dummy" report input field (with Ascending).
Moreover, I see that r.recbuf$ format is highly dependant on the no and order of report input fields. That means if I use r.recbuf$, the report would not work correctly in case sundry changes in report input fields are done.
Thanks and regards
Manu