naumit
30th July 2009, 09:46
Hello,
I want to print a TDS report for a range of date but in each documnet there are 2 to 3 entries. But i want to pick only the first item only. Used "as set with one rows" but report only coming for one document not for a range of date.
manish_patel
30th July 2009, 12:52
There are two options:
1. Producing a single result record for each group of records with the same values for each table field listed in the GROUP BY clause. Then select the single record for each group of result using AS SET WITH 1 RAWS clause and send the data to printer.
2. Retrieve all the records in specific order. Compare the value of specific fields with the previous value of that fields. If they are same then just bypass it otherwise send data to printer.
For example:
option1 (GROUP BY):
select tdpur045.orno,tdpur045.pono
from tdpur045
group by tdpur045.orno,tdpur045.pono
having <having condition>
selectdo
select tdpur045.*
from tdpur045
where tdpur045._index1={:tdpur045.orno,:tdpur045.pono}
as set with 1 rows
rprt_send()
endselect
endselect
option2 (ORDER BY):
old.orno=0
old.pono=0
select tdpur045.*
from tdpur045
where <specific condition>
order by tdpur045.orno,tdpur045.pono
selectdo
if tdpur045.orno=old.orno and tdpur045.pono=old.pono then
continue
endif
rprt_send()
old.orno=tdpur045.orno
old.pono=tdpur045.pono
endselect
naumit
30th July 2009, 15:38
Sir,
First of all thank for the reply but actually what is happening now is this that if i enter a range of documents then the result comes correctly but when i give a range of date then the result is not coming right. It would be highly appreciable if u cud help me in any way
manish_patel
31st July 2009, 06:23
Please upload your code and also mentioned selection criteria; so someone can help you.