evertsen
11th October 2002, 22:09
I've created a custom print session which uses a custom table. The problem is that the first record on the report always print twice (the first time with no quantity). Does any one know why it's doing this?

Here's the code:


declaration:

table ttivkm001

extern domain tcorno orno.f
extern domain tcorno orno.t

form.1:
init.form:
get.screen.defaults()

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif

field.orno.f:
when.field.changes:
orno.t = orno.f

functions:

function read.main.table()
{
select tivkm001.*
from tivkm001
where tivkm001.orno inrange :orno.f and :orno.t
selectdo
rprt_send()
endselect
}


Thanks,
Ev

mark_h
11th October 2002, 22:53
What are your report layouts? Also have you made sure that the data is not in your table twice - just checking.

Mark

evertsen
11th October 2002, 22:59
If I set up the report layouts to consolidate like records (i.e. using after.field instead of detail) then the extra record disappears... however this is not desirable in this case. I have verified that the data is not in the table twice.

Ev

mark_h
11th October 2002, 23:12
I do not see anything in the code, so I suspect something in the report. Do all you have is a header and detail layout? Have you put it into debug mode and stepped thru it to see what the program is reading in from the temp files. This may also show where the extra detail line is coming from. Is there anything in the report script?

Mark

evertsen
12th October 2002, 00:08
Since the program script isn't the problem, I've taken one of the reports and stripped out anything unnecessary. No report script and only an after.field. I think the problem is in the sorting done by the report. I'm going to test this out to see if I can pinpoint the problem. Once I find it I'll post to possibly find out the "why" of the issue.

Thanks,
Ev