Elrodyn
15th January 2012, 18:57
Dear way of the baan/LN Gurus,
I have a problem on the report of tisfc0401, i want to create a report of production order that print also the materials.
so for example, the production order is prod0001 and there are 6 lines of material the display will be:
prod order : prod0001
material:
1 item A 5
2 item B 10
3 item C 20
....
..
6 item D 5
the problem is the details lines that contains the material item code and quantity is printed only once, and it only shows the last item. i already created a variable test to check how many of the details that looping and the result is 6, but it still only printed once.
below is part of my code on the details:
Detail.3:
before.layout:
Select
ticst001.sitm:ItemCodeLine,ticst001.pono
From ticst001
where ticst001.pdno = :tisfc001.pdno
Selectdo
test=test+1
layout.again()
selectempty
lattr.print = false
endselect
it seems my problem is similar to this:
http://www.baanboard.com/baanboard/showthread.php?t=30479&highlight=layout.again
but unfortunately the solution there did not solve my problem, please help me on this.
Thank You,
Roy
mark_h
17th January 2012, 19:48
The post by en@frrom should contain the solution. Notice what he is doing - getting 1 row at a time using "> " to always get the next record. Your code should do the same type actions. The code you posted would always find the first record and then do layout.again. Below is something like your code should look like.
detail.2:
before.layout:
holdpono = 0
Detail.3:
before.layout:
Select ticst001.sitm:ItemCodeLine,ticst001.pono
From ticst001
where ticst001.pdno = :tisfc001.pdno
and ticst001.pono > :holdpono
as set with 1 rows
Selectdo
holdpono = ticst001.pono
layout.again()
selectempty
lattr.print = false
endselect
ipineda
17th January 2012, 22:57
A different approach to get what you need is to use ticst001 as the main table in the report so you will loop as many times as the number of materials you have. In this case each material will be a detail in the report and you can use a before.field to show the info about the SFC order. Obviously this is applicable only if you can create new report functionality because if you just want to customize this don“t make any sense. In the latest, I suggest to try mark_h commentaries and see what happen.
Elrodyn
18th January 2012, 06:24
Hello All,
i will try the solutions today.
it was pretty funny because i remember doing the exact same thing with layout.again() function and it worked as it should...but it is not happening now.
Thanks,
Roy
Elrodyn
19th January 2012, 09:18
Hello,
I already tried the script...but it still returned only the last row...i wonder where did it went wrong...
Roy
mark_h
19th January 2012, 17:41
Post your complete script. Or maybe try moving the detail.3 to the after.layout. The few reports I checked I always do the layout.again in an after.layout event to keep looping. In my mind doing it in the before.layout - actually happens before it prints, and loops. Then would only print the last one.
Elrodyn
19th January 2012, 18:29
Hello Mark,
below is the full code of my report.
|******************************************************************************
|* tisfc040101000 VRC B60 a dr38
|* Production Orders by Order Number
|*
|* 12-01-12 [20:36]
|****************************** declaration section ***************************
declaration:
extern domain tcdsca DESCRIPTION
extern domain tcuef.effn COLOR
extern domain tcdsca COLORDESCRIPTION
extern domain tcutcs PlanDelDate
extern domain tcitem ItemCodeLine
extern domain tcdsca DescriptionLine
extern domain tiqcp1 EstQTY
extern domain tiqcp1 NetQTY
extern domain tcopno STARTOPR
extern domain tcopno NEXTOPR
extern domain tctano TASK
extern domain tirou.mcno MACHINE
extern domain tcamnt holdpono
table ttisfc001 |Production Order
table ttcibd001 |Item General
table ttisfc005 |Order Distribution
table ttcuef002 |Unit Effectivity
table ttisfc010 |Production Order Line
table tticst001 |Production Order Line Estimated Material Line
before.program:
test =0
Header.1:
before.layout:
Select
tcibd001.dsca:DESCRIPTION
From tcibd001
where tcibd001.item ={:tisfc001.mitm}
SelectDo
EndSelect
Select
tisfc005.effn:COLOR
From tisfc005
where tisfc005.pdno ={:tisfc001.pdno}
SelectDo
EndSelect
Select
tisfc001.pldt:PlanDelDate
From tisfc001
where tisfc001.pdno ={:tisfc001.pdno}
SelectDo
EndSelect
detail.1:
before.layout:
holdpono = 0
Detail.2:
before.layout:
Select tisfc001.pdno,ticst001.pdno,ticst001.sitm:ItemCodeLine,ticst001.pono
From ticst001
where
ticst001.pdno = {:tisfc001.pdno}
and
ticst001.pono > :holdpono
as set with 1 rows
Selectdo
holdpono = ticst001.pono
layout.again()
selectempty
lattr.print = false
endselect
let me try your solution again....i am really curious of this report, please help me solve this problem.
Thanks,
Roy
mark_h
19th January 2012, 19:53
Yeah try it in the after.layout. The first line printed might have a 0 in it, but that can be remedied.