Page 1 of 1

Re: report order by problem

Posted: Thu Oct 12, 2006 12:54 am
by mfa786
sir
when i use this query

SELECT VOUMASTER.discription,cheqno,NVL(SUBSTR(VOUMASTER.cheqno,10,10),0) AS chqno,VOUMASTER.entdate,VOUDETAIL.vno,VOUDETAIL.accid,VOUDETAIL.debit,VOUDETAIL.credit,CHARTOFACC.title AS acc_title,PARTYTABLE.title AS PARTY,DEPARTMENT.title AS DEPT
FROM VOUDETAIL,VOUMASTER,CHARTOFACC ,PARTYTABLE,DEPARTMENTMFA DEPARTMENT WHERE
VOUMASTER.vno=VOUDETAIL.vno AND
VOUDETAIL.accid=CHARTOFACC.accid AND
VOUMASTER.partyid=PARTYTABLE.partyid(+) AND VOUDETAIL.deptid=DEPARTMENT.deptid(+)
AND SUBSTR(VOUMASTER.vno,1,2)='BP' AND NVL(SUBSTR(VOUMASTER.cheqno,10,10),0) >0
ORDER BY chqno ASC

then get rigth result
chqno date
11009201 04-JUL-05
11009201 04-JUL-05
11009236 01-JUL-05
11009236 01-JUL-05
11009236 01-JUL-05
11009237 01-JUL-05
11009237 01-JUL-05
11009238 01-JUL-05
11009238 01-JUL-05
11009239 01-JUL-05
11009239 01-JUL-05
11009240 01-JUL-05
11009240 01-JUL-05
11009243 19-JUL-05
11009243 19-JUL-05
11009243 19-JUL-05
11009247 01-JUL-05
11009247 01-JUL-05


but when this query use in report then system not give me right result
not sort on chqno give me result unorder such as
start from

11009236
11009237
11009238
11009239
11009231
11009206
11009246
11009250
11009255
11009256
11009235

sir my cheqno field is string i convert to number by using nvl(cheq,0)
this type of result
sir how i get right restul and give me idea how i set order by through use property
like as form order by property
please give me idea how i set order by by useing report order by property

thank
aamir

Posted: Thu Oct 12, 2006 1:26 am
by najm
Its very Easy to do in a report you have a groups fields in your data model see in which group the chqno is then select it and drag it on the top of the same group your problem is solved your report is now in order of chqno.

Thanks

Cheers

Posted: Thu Oct 12, 2006 6:02 am
by Kashif
Use TO_NUMBER Function to Convert Varchar to Number
Like

TO_NUMBER(NVL(SUBSTR(VOUMASTER.cheqno,10,10),0)) AS chqno


and user Order by Clause in ur Report Query
Like

ORDER BY TO_NUMBER(NVL(SUBSTR(VOUMASTER.cheqno,10,10),0)) ASC

Inshallah Ur Problem will solved.