Hi,
Thanks a lot Elmer and all....
Thnaks for helping in detail...
Best regards,
Sajjad
>Your example code brings several questions.
>1. Why are you sorting gridalloc1 to gridalloc and then indexing on the same fields in the sorted table? You could index gridalloc1 and relate it to voucher. Just seems like a time consuming extra step.
>2. Is voucher the table with the one record to many in gridalloc?
>3. What fields are you using in the group expression on the report? Vdivision or multiple group bands on vdivision,vtran?
>4. Normally your set relation command should match the index key of the child table. From your example code, depending on the status of "set exact" and "set skip" you may get invalid matching records that are matched only on vdivision or you may not get all records that you expect.
>
>Your group expression should match the index order of the parent, otherwise the report will break groups improperly.
>
>I am making some assumptions here so this may not be exactly what you are wanting to do.
>if Your report groupexpr = vdivision
>
> sele a
> use gridalloc1
> index on gfdiv+gftrtp+gfref to gridalloc1
> sele b
> use voucher
> index on vdivision to voucher
> M.exactset = set("exact")
> set exact off
> SET RELATION TO vdivision into gridalloc1
> go top
> REPO FORM RECEIPTVOUCHER1 PREVIEW
> set exact &exactset
> close table all
>
>if Your report groupexpr = vdivision,vtran...
>
> sele a
> use gridalloc1
> index on gfdiv+gftrtp+gfref to gridalloc1
> sele b
> use voucher
> index on vdivision+vtran+vref to voucher
> M.exactset = set("exact")
> set exact on
> SET RELATION TO vdivision+vtran+vref into gridalloc1
> set skip to gridalloc1
> go top
> REPO FORM RECEIPTVOUCHER1 PREVIEW
> set exact &exactset
> close table all
>
>As Hilmar suggested you could join the 2 tables in a SQL select and sort them as needed to create a single cursor. Something like this.
>
>Select a.vdivision,a.vtran,a.vref,a...<other fields from voucher>,;
>b.gfdiv,b.gftrtp,b.gfref,b...<other fields from gridalloc1> ;
>from voucher a, gridalloc1 b into cursor receiptvoucher ;
>where a.vdivision = b.gfdiv and a.vtran = b.gftrtp ;
>and a.vref = b.gfref order by a.vdivision,a.vtran,a.vref
>
>REPO FORM RECEIPTVOUCHER1 PREVIEW
> close table all
>
>
>HTH
>Elmer
>
>>Hi,
>>
>>When I am using set skip to
>>Its working fine. While if I am running same form through menu toolbar. its not giving all detail record. Any reason..please????
>>
>>TIA,
>>
>>
>>>Check "SET SKIP TO ..." in help for creating one to many relations to see all records in child table.
>>>
>>>HTH
>>>Elmer
Sajjad Ahmad