>>>Ok, finally I've realized, that I can not use scan/endscan and I have to switch to
>>>
>>>for i=1 to reccount() + 1
>>>
>>>next
>>>
>>>Thanks.
>>
>>Alowing that you missed 'skip' in a hurry, hv to ask ;
>>What is the diff ? It comes down to the same any way you turn it.
>>Weather u r doing for/skip/next or dowhile/skip/enddo or scan/endscan,
>>you are basically going arround the same bush.
>>
>
>You missed the fact, that I'm looping for reccount() + 1. In other words, I do additional cycle for last record and I also made my if statement slightly different
>
>if not cCarrier_Name == m.lcCarrier_Name or m.lnI = reccount() + 1
> * create file, etc.
>endif
>
>In other words, I needed to create a file for each different client and each different carrier. If I'm using scan/endscan, I have to repeat the code after the scan to create file for the last set of client/carrier. Originally I added a check in scan itself and was surpised, that my eof() or reccount() = recno() didn't work. But then I realized, that my logic dictates one additional loop, that I was able to achieve with for loop.
Hi Naomi,
You got me little bit confused now ...
If you prepared cursor BEFORE this action by having ONE distinct record for each client/carrier then whole thing should be pretty straightforward.
.
scan
->do your thing
endscan
.
No ifs, no buts, no thens , nothing before and nothing afterwards.
If cursor contain GROUPS of records that you hv to process and perform
action for each group of records within this cursor, then you need to
sort your cursor (order by / or index) - similar to as if you wanted to print ordinary grouped report out of it.
So your processing should be embeded in folowing nested scan/endscan construction - typical for grouped processing of records.
select curProcess
go top
scan
lcTrans_pk = curProcess.cTrans_pk
scan while curProcess.cTrans_pk = lcTrans_pk
endscan
skip -1
=PrepareYourFileAndUpdateRelatedData(lcTrans_pk)
endscan
Again no ifs,thens,buts recno()s eof()s bof()s etc.
Aldough I am sure you are NOT gonna go for this, but rather try to
fix your existing code (eh.. we all love our babies...)
- have this in mind next time you come across simmilar case :)