hanibal
24th November 2008, 13:19
i have this report script shown below.i need to print similiar report but with condition to print only the " bom = tibom010.sitm" which have ( "retail.price = tdisa001.prir = 0 ")

i dont know if i can apply this condition in session script as then it will be applied for all reports related to this session,unless there is a way that i dont know to make it apply for 1 report.


------------------------

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 tcqiv1 total.amt.d



double sub.total1(1,100)
double retail.price1(1,100)
|string item.dsca1(50,100)
string unit1(50,100)
string bom.dsca1(50,100)
string bom1(50,100)
double qty1(1,100)
long i,j

domain tcitem bom
domain tcbool print.bom
domain tcdsca bom.dsca
|domain tcdsca item.dsca
domain tccuni unit
domain tiqbm2 qty
|domain tcpric retail.price
|domain tcqiv1 sub.total

before.tdsls401.item.1:
before.layout:
unit.price = 0.00
i = 0
j = 1

select tibom010.*
from tibom010
where tibom010._index1 = {:tdsls401.item}
|as set with 1 rows
selectdo
i = i + 1
j = 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
select tcibd001.*
from tcibd001
where tcibd001._index1 = {:tibom010.sitm}
selectdo
unit1(1,i) = tcibd001.cuni
bom.dsca1(1,i) = tcibd001.dsca
endselect
retail.price1(1,i) = tdisa001.prir
sub.total1(1,i) = tdisa001.prir * tibom010.qana
unit.price = unit.price + tdisa001.prir*tibom010.qana


endselect




endselect




detail.5:
before.layout:

bom= ""
qty = 0


if j <= i then

bom = bom1(1,j)
qty = qty1(1,j)
bom.dsca = bom.dsca1(1,j)
unit = unit1(1,j)
retail.price = retail.price1(1,j)
sub.total = sub.total1(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
bom.dsca1(1,j) = ""
unit1(1,j) = ""
retail.price1(1,j) = 0
sub.total1(1,j) = 0
endfor
print.bom = FALSE
endif

mark_h
24th November 2008, 17:14
Is this in relationship with the other request about 2 reports? Are these to be separate reports? Will the user always print both or just one of the reports?

My typical solution is to give the user two reports and let them pick which one to print. One report would give all information and the other report would only print the exception records. I would do the coding in the session script to skip rprt_send for those records that do not meet the criteria.

Another way to accomplish this is to do it in the report script. You pass the report a flag that says print only 0 price items. Then if the price is not zero do not add to the bom and qty arrays. Use a continue to get the next item.

hanibal
25th November 2008, 06:41
the user want 1 report to b printed,but in case some item have price az 0 ,then he want 2 reports to be printed,one report would give all the information and the other report would only pring the exception records " with price = 0 "

"""""Then if the price is not zero do not add to the bom and qty arrays. Use a continue to get the next item ???????????""""""

how this above can be done ?

mark_h
26th November 2008, 03:41
Well based off the requirements it can't be done in the report script with only one report.

You could have two duplicate reports that always run. One prints non-zero records and one prints zero records. The only problem is the user will always get two reports. I have done that before - 1 report for processed records and one for non-processed records. But I had a flag I could put on the layouts. I cloned a report and added on one report a output expression processed = true, the other report had process=false.

But for the second question like this:

select tibom010.*
from tibom010
where tibom010._index1 = {:tdsls401.item}
|as set with 1 rows
selectdo
select tdisa001.*
from tdisa001
where tdisa001._index1 = {:tibom010.sitm}
|group by tdisa001.item
as set with 1 rows
selectdo
select tcibd001.*
from tcibd001
where tcibd001._index1 = {:tibom010.sitm}
selectdo
unit1(1,i) = tcibd001.cuni
bom.dsca1(1,i) = tcibd001.dsca
endselect
retail.price1(1,i) = tdisa001.prir
sub.total1(1,i) = tdisa001.prir * tibom010.qana
unit.price = unit.price + tdisa001.prir*tibom010.qana
endselect
if tdisa001.prir<>0 then | probably need double.cmp here
continue
endif
i = i + 1
bom1(1,i)= tibom010.sitm
qty1(1,i)= tibom010.qana