Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of the SKIP command

Status
Not open for further replies.

TinLegs

Programmer
Jan 14, 2003
100
NZ
I have a Legacy app with a report that reads both a parent and related child file. The two files are linked using the persons Number.
ie. Parent file: Name, Number
Child file (phone no.): Name, Number, Home, Work, Mobile

I want to conditionally SKIP Phone file (child) records. The problem is one Parent record may only be related to just a Home number (=1 phone file record) and another Parent record may have Home, Work & Mobile (=3 Phone related records).

So if I use SKIP(Phones,1) for the child phones file with 3 related records it still reports the remaining two.

If I use SKIP(Phone,3) it appears to work fine but is it problem to SKIP 3 records when for example there may only be one to skip in the phones file?

The Clarion help appears to assume the number of records to SKIP is constant where as mine vary.

So I guess my question is, is it safe to use SKIP(Phones, X) where X could be a greater number than the records to SKIP?

Thanks
 
Hi!

SKIP is a leftover from CPD and ideally should not be used. In your case, you have no idea as to the no of Child records and so the best options if to use a LOOP i.e.

LOOP
NEXT(Phones)

IF ERRORCODE() OR Child.Number <> Parent.Number THEN BREAK.
END

Since I am totally forgotten Legacy, does a Legacy report use a VIEW?

Regards
 
Hi ShankarJ

I was concerned about using SKIP at all so you have answered my question, thank you.

I have had a look at VIEW in the help file but am unsure about its use with legacy.

I have the Phones file on the table schematic which I will remove and manually OPEN, LOOP, CLOSE using embeded code when conditionally required as you have suggested.

Regards


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top