hanibal
19th November 2008, 16:45
hello,
i have a problem and i need help.
u see, i have to create a report wich print an item and its components, for example :
******************************************
ITEM A -----------> ( tdsls401.item)
item components :
COMP A ----------->( tibom010.sitm)
COMP B
COMP C
COMP D
*******************************************
i manage to create everything and still having one problem wich is when i print the report,i am getting first component replaced by last ,example :
ITEM A -----------> ( tdsls401.item)
item components :
COMP D ----------->( tibom010.sitm)
COMP B
COMP C
COMP D
if possible,can someone tell me how to solve this issue ?
rahul.kolhe22
19th November 2008, 16:57
Hi Hanibal,
I think that you may be querying the table tibom010 multiple times while displaying the component for the item in the report.
It will be more clear by looking in the script. Can you post the script.
-- Rahul
george7a
19th November 2008, 16:57
Hi,
Can you please post the script of the report?
- George
hanibal
19th November 2008, 17:19
in session script i have :
function read.main.table()
{
select tdsls401.*
from tdsls401
where tdsls401._index1 inrange {:orno.t}
and {:orno.f}
selectdo
select tdisa001.*
from tdisa001
where tdisa001._index1 = {:tibom010.sitm}
selectdo
sub.total = retail.price * quantity
endselect
endselect
}
and in the report script :
select tibom010.*
from tibom010
where tibom010._index1 = {:tdsls401.item}
selectdo
select tdisa001.*
from tdisa001
where tdisa001._index1 = {:tibom010.sitm}
selectdo
unit.price = sub.total * item.quantity
endselect
endselect
george7a
19th November 2008, 17:25
Where exactly do you have this code in the report script? In what section?
hanibal
19th November 2008, 17:55
i have in section :
before.tdsls401.item.1:
hanibal
19th November 2008, 18:09
and the field tibom010.sitm exist in the "detail " layout
mark_h
20th November 2008, 23:21
I am not sure how this is printing on the report? The reason I ask this is because their is not a layout.again statement. Something to print each of the BOM items. What fields do you have on the report. Why the report script versus the session script? Which is where I would put it.
select tdsls401.*
from tdsls401
where tdsls401._index1 inrange {:orno.t} and {:orno.f}
selectdo
select tibom010.*
from tibom010
where tibom010._index1 = {:tdsls401.item}
selectdo
select tdisa001.*
from tdisa001
where tdisa001._index1 = {:tibom010.sitm}
selectdo
unit.price = sub.total * item.quantity
endselect
rprt_send()
endselect
endselect
What I do not see from your first post is a connection between the selects and tibom010 in the read maintable script. Where is tibom010.sitm coming from? Is it an input field to the report? You might want to post the complete scripts. Makes it hard to make recommendations.
hanibal
21st November 2008, 08:50
i managed to move everything to REPORT SCRIPT so i dont get confused.
and this is the script with details:
declaration:
table ttdisa001
table ttihra350
table ttcmcs008
table ttcibd001
table ttibom010
extern domain tcqiv1 sub.total
extern domain tcpric retail.price
extern domain tcpric unit.price
extern domain tcpric exc.rate
extern domain tcdate uptodate
extern domain tcpric field.test
string bom1(50,100)
long i,j
domain tcmcs.str50 bom
domain tcbool print.bom
double qty1(1,100)
domain tcqsl1 qty
before.tdsls401.item.1:
before.layout:
unit.price = 0.00
select tibom010.*
from tibom010
where tibom010._index1 = {:tdsls401.item}
|as set with 1 rows
selectdo
i = i + 1
bom1(1,i)= tibom010.sitm
qty1(1,i)= tibom010.qana
select tdisa001.*
from tdisa001
where tdisa001._index1 = {:tibom010.sitm}
|group by tdisa001.item
as set with 1 rows
selectdo
retail.price = tdisa001.prir
sub.total = retail.price * tibom010.qana
unit.price = unit.price + tdisa001.prir*tibom010.qana
endselect
select tdsls400.*
from tdsls400
where tdsls400._index1 = {:tdsls401.orno, :tdsls401.pono, :tdsls401.sqnb}
selectdo
if tdsls400.ccur = "USD"
then
exc.rate = 1
total.amt.d = tdsls401.oqua * unit.price
else
select tcmcs008.*
from tcmcs008
where tcmcs008._index1 = {:tdsls400.ccur, "USD", "INT"}
and tcmcs008.stdt >= :tdsls401.ratd
order by tcmcs008._index1 desc
as set with 1 rows
selectdo
if tcmcs008.excb = tcyesno.no
then
exc.rate = tdsls401.rats(2)
total.amt.d = (tdsls401.oqua * unit.price)/exc.rate
else
exc.rate = tdsls401.rats(2)
total.amt.d = tdsls401.oqua * unit.price * exc.rate
endif
|total.amt.d = tdsls401.oqua * unit.price * exc.rate
endselect
endif
endselect
endselect
detail.5:
before.layout:
bom= ""
qty = 0
j = 1
if j <= i then
bom = bom1(1,j)
qty = qty1(1,j)
endif
after.layout:
bom= ""
qty = 0
j = j + 1
if j <= i then
layout.again()
else
for j = 1 to 100
bom1(1,j) = ""
qty1(1,j) = 0
endfor
print.bom = FALSE
endif
mark_h
21st November 2008, 18:12
The first thing I would do is set i=0 right before the select tibom010; not sure that is it but at first glance this is the first thing I noticed. Put in debug mode and make sure j and i are incrementing correctly.
hanibal
22nd November 2008, 11:03
i set i = 0 and eventhou i am getting error while compiling about that :
error1 :bom1(1,i) should have 1 dimension instead of 2
error2: qty1(1,i) should have 0 dimension instead of 2
,i managed to have 1 dimension for Bom1 but still i dont understand why i should have 0 dimension for qty1 ?
i need it to have dimension so i can save data in different variables qty1(1,i) or at least qty1(i)
mark_h
24th November 2008, 05:51
Maybe I am misunderstanding what the script does but the two arrays would would have differnet dimensions. The quantity would be declared long qty(100) - one dimension array which would hold 100 quantity values. Then the bom item which I would declare like this domain tcitem bom(100) - bom is a two dimension array with 100 items that can be 32 characters long. Then in the script you would have qty(i) = somevalue and bom(1,i) = someitem.
hanibal
24th November 2008, 13:20
ok,thank you,i have manage to do it :D
thanks for ur help