Vfp Do While Found Continue Code

Do while loop


Author Message

 Do while loop

I had earlier posed a question about a possible faulty filter (thanks to
those of you who answered). I determined that the real cause of my problems
is that a DO WHILE loop embedded in a SCAN loop is only running the first
time through... after the SCAN loops back to the beginning, it'll go down to
the DO WHILE and skip it completely, even if the criteria for it is true.
Anyone out there heard of such?
-Duffy P. Weber
Weber Consulting

Fri, 12 Sep 2003 10:29:13 GMT

 Do while loop

Duffy,

Can you post some code, and a description of the values in the data?

--

Cindy Winegarden

Microsoft Certified Professional, Visual FoxPro
Microsoft Visual FoxPro MVP

| I had earlier posed a question about a possible faulty filter (thanks to
| those of you who answered). I determined that the real cause of my
problems
| is that a DO WHILE loop embedded in a SCAN loop is only running the first
| time through... after the SCAN loops back to the beginning, it'll go down
to
| the DO WHILE and skip it completely, even if the criteria for it is true.
| Anyone out there heard of such?
| -Duffy P. Weber
| Weber Consulting
|
|
|

Fri, 12 Sep 2003 10:52:41 GMT

 Do while loop

Sure thing! Here's the whole piece- sorry about the commentation. I wasn't
exactly following standard procedure with it ; )
The values are measurements of chemicals found in wells. What I want it to
do is take a date range value specified by the user, look up all the records
with a matching well number and sum it into a variable, then drop it into
"chemuserep", my temporary table. I wan it to loop back through the records
and do it for each well #.
Problem is, it'll do it beautifully for the first well in the list (the one
with the highest well#, as is evident from the code). But for the second
ones, I keep getting the values from when I re-zero the variables (I put a
90 and a 45 instead of zeroes for one variable in each set- that way if I
have a "leak" in my code somewhere I can tell where it's coming from. Best I
can figure, it's not doing the "DO WHILE" the second time around. Thanks for
offering to look! If you find anything pleeease let me know! Thanks a
million!
-Duffy

**zap in chemuserep  **<-- not sure about this... Better way?

lOldAlias=alias()
sele wells
lnRecCrt=recno()
lFilter=filter()

public varkem
public varfound
public varnaflbs
public varnafgals
public varphoslbs
public varphosgals
public varnaohlbs
public varnaohgals
public varcllbs
public varwellz
public vardate1
public vardate2
varfound = .F.
varnaflbs = 0
varnafgals = 0
varphoslbs = 0
varphosgals = 45       && <--REPLACE WITH ZERO!! (This tests for problems
with the reset)
varnaohlbs = 0
varnaohgals = 0
varcllbs = 0
varwellz = 0
varkem = 0
set step on
vardate1 = ctod(thisform.text1.value)
vardate2 = ctod(thisform.text2.value)

set step on

use wells
sele wells

set filter to wells.date >= vardate1 and wells.date <= vardate2
count to thisform.nchem

set step on

 calc max(val(wellno)) to varwellz

count to varkem

scan

do while varkem > 0
locate for val(wells.wellno) = varwellz
do while val(wells.wellno) = varwellz
varnaflbs = varnaflbs + val(wells.naflbs)
varnafgals = varnafgals + val(wells.nafgals)
varphoslbs = varphoslbs + val(wells.phoslbs)
varphosgals = varphosgals + val(wells.phosgals)
varnaohlbs = varnaohlbs + val(wells.naohlbs)
varnaohgals = varnaohgals + val(wells.naohgals)
varcllbs = varcllbs + val(wells.cllbs)
varfound = .T.

**skip
**loop &&Keep an eye on this
continue
enddo

set step on
*if varfound = .T.
sele chemuserep
insert into chemuserep (wellno, cllbs, naohgals, naohlbs, phosgals, phoslbs,
nafgals, naflbs) ;
values (varwellz, varcllbs, varnaohgals, varnaohlbs, varphosgals,
varphoslbs, varnafgals, varnaflbs)
*endif

set step on

varfound = .F.
varnaflbs = 0
varnafgals = 0
varphoslbs = 0
varphosgals = 0
varnaohlbs = 90    && <--REPLACE WITH ZERO!! (This tests for problems with
the reset)
varnaohgals = 0
varcllbs = 0

sele wells
set filter to wells.date >= vardate1 and wells.date <= vardate2 and
val(wells.wellno) < varwellz
count to varkem
calc max(val(wellno)) to varwellz

**loop
enddo

endscan

set step on

sele chemuserep
set filter to
repo form chemuserep to printer noconsole
set filter to
sele (lOldAlias)

Quote:

> Duffy,

> Can you post some code, and a description of the values in the data?

> --

> Cindy Winegarden

> Microsoft Certified Professional, Visual FoxPro
> Microsoft Visual FoxPro MVP

> | I had earlier posed a question about a possible faulty filter (thanks to
> | those of you who answered). I determined that the real cause of my
> problems
> | is that a DO WHILE loop embedded in a SCAN loop is only running the
first
> | time through... after the SCAN loops back to the beginning, it'll go
down
> to
> | the DO WHILE and skip it completely, even if the criteria for it is
true.
> | Anyone out there heard of such?
> | -Duffy P. Weber
> | Weber Consulting
> |
> |
> |

Sat, 13 Sep 2003 01:24:50 GMT

 Do while loop

PS- most of the SCAN/LOOP etc stuff that's commented out is gonna stay that
way and be deleted before final compile. I tend to leave these things in for
reference until the last minute. It just seems to work better for our team,
but some find it annoying.

Quote:

> Duffy,

> Can you post some code, and a description of the values in the data?

> --

> Cindy Winegarden

> Microsoft Certified Professional, Visual FoxPro
> Microsoft Visual FoxPro MVP

> | I had earlier posed a question about a possible faulty filter (thanks to
> | those of you who answered). I determined that the real cause of my
> problems
> | is that a DO WHILE loop embedded in a SCAN loop is only running the
first
> | time through... after the SCAN loops back to the beginning, it'll go
down
> to
> | the DO WHILE and skip it completely, even if the criteria for it is
true.
> | Anyone out there heard of such?
> | -Duffy P. Weber
> | Weber Consulting
> |
> |
> |

Sat, 13 Sep 2003 01:28:07 GMT

 Do while loop

I had a job understanding your DO WHILE...ENDDO loops and
the LOCATE within the SCAN...ENDSCAN
So maybe I'm missing the point.

However, couldn't you achieve what you want with the following (?):
(BTW make your form.text1 and form.text2 values of date type.
You'll avoid the unnecessary problems with using CTOD)

**Begin code**
LOCAL vardate2,vardate1

IF USED("chemuserep")
USE IN "chemuserep"
ENDIF

vardate1 = thisform.text1.value
vardate2 = thisform.text2.value

SELECT VAL(wellno) as wellno, VAL(cllbs) as cllbs , ;
VAL(naohgals) as naohgals, VAL(naohlbs) as naohlbs , ;
VAL(phosgals) as phosgals, VAL(phoslbs) as phoslbs, ;
VAL(nafgals) as nafgals, VAL(naflbs) as naflbs ;
FROM wells ;
WHERE wells.date BETWEEN vardate1 AND vardate2 ;
INTO CURSOR chemuserep ;
ORDER BY 1 DESC ;

SELECT chemuserep

repo form chemuserep to printer noconsole
**End code**

Roger

Quote:

> Sure thing! Here's the whole piece- sorry about the commentation. I wasn't
> exactly following standard procedure with it ; )
> The values are measurements of chemicals found in wells. What I want it to
> do is take a date range value specified by the user, look up all the records
> with a matching well number and sum it into a variable, then drop it into
> "chemuserep", my temporary table. I wan it to loop back through the records
> and do it for each well #.
> Problem is, it'll do it beautifully for the first well in the list (the one
> with the highest well#, as is evident from the code). But for the second
> ones, I keep getting the values from when I re-zero the variables (I put a
> 90 and a 45 instead of zeroes for one variable in each set- that way if I
> have a "leak" in my code somewhere I can tell where it's coming from. Best I
> can figure, it's not doing the "DO WHILE" the second time around. Thanks for
> offering to look! If you find anything pleeease let me know! Thanks a
> million!
> -Duffy

> **zap in chemuserep  **<-- not sure about this... Better way?

> lOldAlias=alias()
> sele wells
> lnRecCrt=recno()
> lFilter=filter()

> public varkem
> public varfound
> public varnaflbs
> public varnafgals
> public varphoslbs
> public varphosgals
> public varnaohlbs
> public varnaohgals
> public varcllbs
> public varwellz
> public vardate1
> public vardate2
> varfound = .F.
> varnaflbs = 0
> varnafgals = 0
> varphoslbs = 0
> varphosgals = 45       && <--REPLACE WITH ZERO!! (This tests for problems
> with the reset)
> varnaohlbs = 0
> varnaohgals = 0
> varcllbs = 0
> varwellz = 0
> varkem = 0
>  set step on
>  vardate1 = ctod(thisform.text1.value)
>  vardate2 = ctod(thisform.text2.value)

> set step on

> use wells
> sele wells

> set filter to wells.date >= vardate1 and wells.date <= vardate2
> count to thisform.nchem

> set step on

>  calc max(val(wellno)) to varwellz

> count to varkem

> scan

> do while varkem > 0
> locate for val(wells.wellno) = varwellz
> do while val(wells.wellno) = varwellz
> varnaflbs = varnaflbs + val(wells.naflbs)
> varnafgals = varnafgals + val(wells.nafgals)
> varphoslbs = varphoslbs + val(wells.phoslbs)
> varphosgals = varphosgals + val(wells.phosgals)
> varnaohlbs = varnaohlbs + val(wells.naohlbs)
> varnaohgals = varnaohgals + val(wells.naohgals)
> varcllbs = varcllbs + val(wells.cllbs)
> varfound = .T.

> **skip
> **loop &&Keep an eye on this
> continue
> enddo

> set step on
> *if varfound = .T.
> sele chemuserep
> insert into chemuserep (wellno, cllbs, naohgals, naohlbs, phosgals, phoslbs,
> nafgals, naflbs) ;
> values (varwellz, varcllbs, varnaohgals, varnaohlbs, varphosgals,
> varphoslbs, varnafgals, varnaflbs)
> *endif

> set step on

> varfound = .F.
> varnaflbs = 0
> varnafgals = 0
> varphoslbs = 0
> varphosgals = 0
> varnaohlbs = 90    && <--REPLACE WITH ZERO!! (This tests for problems with
> the reset)
> varnaohgals = 0
> varcllbs = 0

> sele wells
> set filter to wells.date >= vardate1 and wells.date <= vardate2 and
> val(wells.wellno) < varwellz
> count to varkem
>  calc max(val(wellno)) to varwellz

> **loop
> enddo

> endscan

> set step on

> sele chemuserep
> set filter to
> repo form chemuserep to printer noconsole
> set filter to
> sele (lOldAlias)

[snipped previous]

Fri, 12 Sep 2003 23:35:09 GMT

 Do while loop

Actually, it's a good thought, but the cursor returns 5 copies of the first
record within the filter. I kinda have this set up a little differently
because the for it runs from accesses all the tables and reports at once
basically. I'd really like to stick with the temp table code.... it works
(the first time thru). I'm just trying to figure out why it won't repeat the
"do while" loop. Good thought tho! Thanks!! = )

Quote:

> I had a job understanding your DO WHILE...ENDDO loops and
> the LOCATE within the SCAN...ENDSCAN
> So maybe I'm missing the point.

> However, couldn't you achieve what you want with the following (?):
> (BTW make your form.text1 and form.text2 values of date type.
> You'll avoid the unnecessary problems with using CTOD)

> **Begin code**
> LOCAL vardate2,vardate1

> IF USED("chemuserep")
>  USE IN "chemuserep"
> ENDIF

> vardate1 = thisform.text1.value
> vardate2 = thisform.text2.value

> SELECT VAL(wellno) as wellno, VAL(cllbs) as cllbs , ;
>     VAL(naohgals) as naohgals, VAL(naohlbs) as naohlbs , ;
>     VAL(phosgals) as phosgals, VAL(phoslbs) as phoslbs, ;
>      VAL(nafgals) as nafgals, VAL(naflbs) as naflbs ;
>     FROM wells ;
>     WHERE wells.date BETWEEN vardate1 AND vardate2 ;
>     INTO CURSOR chemuserep ;
>     ORDER BY 1 DESC ;

> SELECT chemuserep

> repo form chemuserep to printer noconsole
> **End code**

> Roger

> > Sure thing! Here's the whole piece- sorry about the commentation. I
wasn't
> > exactly following standard procedure with it ; )
> > The values are measurements of chemicals found in wells. What I want it
to
> > do is take a date range value specified by the user, look up all the
records
> > with a matching well number and sum it into a variable, then drop it
into
> > "chemuserep", my temporary table. I wan it to loop back through the
records
> > and do it for each well #.
> > Problem is, it'll do it beautifully for the first well in the list (the
one
> > with the highest well#, as is evident from the code). But for the second
> > ones, I keep getting the values from when I re-zero the variables (I put
a
> > 90 and a 45 instead of zeroes for one variable in each set- that way if
I
> > have a "leak" in my code somewhere I can tell where it's coming from.
Best I
> > can figure, it's not doing the "DO WHILE" the second time around. Thanks
for
> > offering to look! If you find anything pleeease let me know! Thanks a
> > million!
> > -Duffy

> > **zap in chemuserep  **<-- not sure about this... Better way?

> > lOldAlias=alias()
> > sele wells
> > lnRecCrt=recno()
> > lFilter=filter()

> > public varkem
> > public varfound
> > public varnaflbs
> > public varnafgals
> > public varphoslbs
> > public varphosgals
> > public varnaohlbs
> > public varnaohgals
> > public varcllbs
> > public varwellz
> > public vardate1
> > public vardate2
> > varfound = .F.
> > varnaflbs = 0
> > varnafgals = 0
> > varphoslbs = 0
> > varphosgals = 45       && <--REPLACE WITH ZERO!! (This tests for
problems
> > with the reset)
> > varnaohlbs = 0
> > varnaohgals = 0
> > varcllbs = 0
> > varwellz = 0
> > varkem = 0
> >  set step on
> >  vardate1 = ctod(thisform.text1.value)
> >  vardate2 = ctod(thisform.text2.value)

> > set step on

> > use wells
> > sele wells

> > set filter to wells.date >= vardate1 and wells.date <= vardate2
> > count to thisform.nchem

> > set step on

> >  calc max(val(wellno)) to varwellz

> > count to varkem

> > scan

> > do while varkem > 0
> > locate for val(wells.wellno) = varwellz
> > do while val(wells.wellno) = varwellz
> > varnaflbs = varnaflbs + val(wells.naflbs)
> > varnafgals = varnafgals + val(wells.nafgals)
> > varphoslbs = varphoslbs + val(wells.phoslbs)
> > varphosgals = varphosgals + val(wells.phosgals)
> > varnaohlbs = varnaohlbs + val(wells.naohlbs)
> > varnaohgals = varnaohgals + val(wells.naohgals)
> > varcllbs = varcllbs + val(wells.cllbs)
> > varfound = .T.

> > **skip
> > **loop &&Keep an eye on this
> > continue
> > enddo

> > set step on
> > *if varfound = .T.
> > sele chemuserep
> > insert into chemuserep (wellno, cllbs, naohgals, naohlbs, phosgals,
phoslbs,
> > nafgals, naflbs) ;
> > values (varwellz, varcllbs, varnaohgals, varnaohlbs, varphosgals,
> > varphoslbs, varnafgals, varnaflbs)
> > *endif

> > set step on

> > varfound = .F.
> > varnaflbs = 0
> > varnafgals = 0
> > varphoslbs = 0
> > varphosgals = 0
> > varnaohlbs = 90    && <--REPLACE WITH ZERO!! (This tests for problems
with
> > the reset)
> > varnaohgals = 0
> > varcllbs = 0

> > sele wells
> > set filter to wells.date >= vardate1 and wells.date <= vardate2 and
> > val(wells.wellno) < varwellz
> > count to varkem
> >  calc max(val(wellno)) to varwellz

> > **loop
> > enddo

> > endscan

> > set step on

> > sele chemuserep
> > set filter to
> > repo form chemuserep to printer noconsole
> > set filter to
> > sele (lOldAlias)

> [snipped previous]

Sat, 13 Sep 2003 03:50:09 GMT

 Do while loop

Hi Duffy,

If I'm reading this correctly,

Quote:

>  calc max(val(wellno)) to varwellz

> **loop
> enddo

> endscan

The calc max(...) will leave the record pointer at EOF() after the first
run. When the ENDSCAN is reached the loop will terminate because it thinks
it's reached the end.

Assuming you want to do stuff for each value of varwellz between the two
dates, you could, for example,  set filter on dates, index on well number
and do your stuff for each well in a single pass of the table, e.g.

use wells order wellorder
set filter to myDate >= myDateVar1 and myDate <= myDateVar2
go top ** or locate

do while !eof()
varwellz = wellno
** reset counters **
scan while wellno = varwellz
** do stuff
endscan
enddo

HTH,
Neil

Quote:

> Sure thing! Here's the whole piece- sorry about the commentation. I wasn't
> exactly following standard procedure with it ; )
> The values are measurements of chemicals found in wells. What I want it to
> do is take a date range value specified by the user, look up all the
records
> with a matching well number and sum it into a variable, then drop it into
> "chemuserep", my temporary table. I wan it to loop back through the
records
> and do it for each well #.
> Problem is, it'll do it beautifully for the first well in the list (the
one
> with the highest well#, as is evident from the code). But for the second
> ones, I keep getting the values from when I re-zero the variables (I put a
> 90 and a 45 instead of zeroes for one variable in each set- that way if I
> have a "leak" in my code somewhere I can tell where it's coming from. Best
I
> can figure, it's not doing the "DO WHILE" the second time around. Thanks
for
> offering to look! If you find anything pleeease let me know! Thanks a
> million!
> -Duffy

> **zap in chemuserep  **<-- not sure about this... Better way?

> lOldAlias=alias()
> sele wells
> lnRecCrt=recno()
> lFilter=filter()

> public varkem
> public varfound
> public varnaflbs
> public varnafgals
> public varphoslbs
> public varphosgals
> public varnaohlbs
> public varnaohgals
> public varcllbs
> public varwellz
> public vardate1
> public vardate2
> varfound = .F.
> varnaflbs = 0
> varnafgals = 0
> varphoslbs = 0
> varphosgals = 45       && <--REPLACE WITH ZERO!! (This tests for problems
> with the reset)
> varnaohlbs = 0
> varnaohgals = 0
> varcllbs = 0
> varwellz = 0
> varkem = 0
>  set step on
>  vardate1 = ctod(thisform.text1.value)
>  vardate2 = ctod(thisform.text2.value)

> set step on

> use wells
> sele wells

> set filter to wells.date >= vardate1 and wells.date <= vardate2
> count to thisform.nchem

> set step on

>  calc max(val(wellno)) to varwellz

> count to varkem

> scan

> do while varkem > 0
> locate for val(wells.wellno) = varwellz
> do while val(wells.wellno) = varwellz
> varnaflbs = varnaflbs + val(wells.naflbs)
> varnafgals = varnafgals + val(wells.nafgals)
> varphoslbs = varphoslbs + val(wells.phoslbs)
> varphosgals = varphosgals + val(wells.phosgals)
> varnaohlbs = varnaohlbs + val(wells.naohlbs)
> varnaohgals = varnaohgals + val(wells.naohgals)
> varcllbs = varcllbs + val(wells.cllbs)
> varfound = .T.

> **skip
> **loop &&Keep an eye on this
> continue
> enddo

> set step on
> *if varfound = .T.
> sele chemuserep
> insert into chemuserep (wellno, cllbs, naohgals, naohlbs, phosgals,
phoslbs,
> nafgals, naflbs) ;
> values (varwellz, varcllbs, varnaohgals, varnaohlbs, varphosgals,
> varphoslbs, varnafgals, varnaflbs)
> *endif

> set step on

> varfound = .F.
> varnaflbs = 0
> varnafgals = 0
> varphoslbs = 0
> varphosgals = 0
> varnaohlbs = 90    && <--REPLACE WITH ZERO!! (This tests for problems with
> the reset)
> varnaohgals = 0
> varcllbs = 0

> sele wells
> set filter to wells.date >= vardate1 and wells.date <= vardate2 and
> val(wells.wellno) < varwellz
> count to varkem
> set step on

> sele chemuserep
> set filter to
> repo form chemuserep to printer noconsole
> set filter to
> sele (lOldAlias)

> > Duffy,

> > Can you post some code, and a description of the values in the data?

> > --

> > Cindy Winegarden

> > Microsoft Certified Professional, Visual FoxPro
> > Microsoft Visual FoxPro MVP

> > | I had earlier posed a question about a possible faulty filter (thanks
to
> > | those of you who answered). I determined that the real cause of my
> > problems
> > | is that a DO WHILE loop embedded in a SCAN loop is only running the
> first
> > | time through... after the SCAN loops back to the beginning, it'll go
> down
> > to
> > | the DO WHILE and skip it completely, even if the criteria for it is
> true.
> > | Anyone out there heard of such?
> > | -Duffy P. Weber
> > | Weber Consulting
> > |
> > |
> > |

Sat, 13 Sep 2003 02:26:04 GMT

 Do while loop

You're right- it's not going to the top of the file. It's re-scanning for
the new well #'s because it's inside the main scan loop (the one that says
"DO WHILE varkem > 0")
The *stuff to do* is inside the secondary loop. Is there a way to move the
record pointer to the top of a set of filtered records? GO TOP isn't working
the way I'd hoped. I apologise for the inane questions. (I'm working on 3
projects at once, and right now nothin' makes sense!) I really appreciate
the help. You got the diagnostic right on the head! = )

Quote:

> Hi Duffy,

> If I'm reading this correctly,

> >  calc max(val(wellno)) to varwellz

> > **loop
> > enddo

> > endscan

> The calc max(...) will leave the record pointer at EOF() after the first
> run. When the ENDSCAN is reached the loop will terminate because it thinks
> it's reached the end.

> Assuming you want to do stuff for each value of varwellz between the two
> dates, you could, for example,  set filter on dates, index on well number
> and do your stuff for each well in a single pass of the table, e.g.

> use wells order wellorder
> set filter to myDate >= myDateVar1 and myDate <= myDateVar2
> go top ** or locate

> do while !eof()
>   varwellz = wellno
>   ** reset counters **
>   scan while wellno = varwellz
>      ** do stuff
>   endscan
> enddo

> HTH,
> Neil

> > Sure thing! Here's the whole piece- sorry about the commentation. I
wasn't
> > exactly following standard procedure with it ; )
> > The values are measurements of chemicals found in wells. What I want it
to
> > do is take a date range value specified by the user, look up all the
> records
> > with a matching well number and sum it into a variable, then drop it
into
> > "chemuserep", my temporary table. I wan it to loop back through the
> records
> > and do it for each well #.
> > Problem is, it'll do it beautifully for the first well in the list (the
> one
> > with the highest well#, as is evident from the code). But for the second
> > ones, I keep getting the values from when I re-zero the variables (I put
a
> > 90 and a 45 instead of zeroes for one variable in each set- that way if
I
> > have a "leak" in my code somewhere I can tell where it's coming from.
Best
> I
> > can figure, it's not doing the "DO WHILE" the second time around. Thanks
> for
> > offering to look! If you find anything pleeease let me know! Thanks a
> > million!
> > -Duffy

> > **zap in chemuserep  **<-- not sure about this... Better way?

> > lOldAlias=alias()
> > sele wells
> > lnRecCrt=recno()
> > lFilter=filter()

> > public varkem
> > public varfound
> > public varnaflbs
> > public varnafgals
> > public varphoslbs
> > public varphosgals
> > public varnaohlbs
> > public varnaohgals
> > public varcllbs
> > public varwellz
> > public vardate1
> > public vardate2
> > varfound = .F.
> > varnaflbs = 0
> > varnafgals = 0
> > varphoslbs = 0
> > varphosgals = 45       && <--REPLACE WITH ZERO!! (This tests for
problems
> > with the reset)
> > varnaohlbs = 0
> > varnaohgals = 0
> > varcllbs = 0
> > varwellz = 0
> > varkem = 0
> >  set step on
> >  vardate1 = ctod(thisform.text1.value)
> >  vardate2 = ctod(thisform.text2.value)

> > set step on

> > use wells
> > sele wells

> > set filter to wells.date >= vardate1 and wells.date <= vardate2
> > count to thisform.nchem

> > set step on

> >  calc max(val(wellno)) to varwellz

> > count to varkem

> > scan

> > do while varkem > 0
> > locate for val(wells.wellno) = varwellz
> > do while val(wells.wellno) = varwellz
> > varnaflbs = varnaflbs + val(wells.naflbs)
> > varnafgals = varnafgals + val(wells.nafgals)
> > varphoslbs = varphoslbs + val(wells.phoslbs)
> > varphosgals = varphosgals + val(wells.phosgals)
> > varnaohlbs = varnaohlbs + val(wells.naohlbs)
> > varnaohgals = varnaohgals + val(wells.naohgals)
> > varcllbs = varcllbs + val(wells.cllbs)
> > varfound = .T.

> > **skip
> > **loop &&Keep an eye on this
> > continue
> > enddo

> > set step on
> > *if varfound = .T.
> > sele chemuserep
> > insert into chemuserep (wellno, cllbs, naohgals, naohlbs, phosgals,
> phoslbs,
> > nafgals, naflbs) ;
> > values (varwellz, varcllbs, varnaohgals, varnaohlbs, varphosgals,
> > varphoslbs, varnafgals, varnaflbs)
> > *endif

> > set step on

> > varfound = .F.
> > varnaflbs = 0
> > varnafgals = 0
> > varphoslbs = 0
> > varphosgals = 0
> > varnaohlbs = 90    && <--REPLACE WITH ZERO!! (This tests for problems
with
> > the reset)
> > varnaohgals = 0
> > varcllbs = 0

> > sele wells
> > set filter to wells.date >= vardate1 and wells.date <= vardate2 and
> > val(wells.wellno) < varwellz
> > count to varkem
> > set step on

> > sele chemuserep
> > set filter to
> > repo form chemuserep to printer noconsole
> > set filter to
> > sele (lOldAlias)

> > > Duffy,

> > > Can you post some code, and a description of the values in the data?

> > > --

> > > Cindy Winegarden

> > > Microsoft Certified Professional, Visual FoxPro
> > > Microsoft Visual FoxPro MVP

> > > | I had earlier posed a question about a possible faulty filter
(thanks
> to
> > > | those of you who answered). I determined that the real cause of my
> > > problems
> > > | is that a DO WHILE loop embedded in a SCAN loop is only running the
> > first
> > > | time through... after the SCAN loops back to the beginning, it'll go
> > down
> > > to
> > > | the DO WHILE and skip it completely, even if the criteria for it is
> > true.
> > > | Anyone out there heard of such?
> > > | -Duffy P. Weber
> > > | Weber Consulting
> > > |
> > > |
> > > |

Sat, 13 Sep 2003 07:18:51 GMT

 Do while loop

I would double and triple check the condition(s) for that
DO WHILE.  Many times I've thought the same thing, "This
thing isn't working!"  Later to find that I was not seeing
something and VFP was working as it should.  Not saying
it may not be a bug, but incorrectly evaluating a logical
result is not very likely.

-- TRW

Quote:


> I had earlier posed a question about a possible faulty filter (thanks to
> those of you who answered). I determined that the real cause of my problems
> is that a DO WHILE loop embedded in a SCAN loop is only running the first
> time through... after the SCAN loops back to the beginning, it'll go down to
> the DO WHILE and skip it completely, even if the criteria for it is true.
> Anyone out there heard of such?
> -Duffy P. Weber
> Weber Consulting

--
_______________________________________
My e-mail:  t r w 7

_______________________________________

Tue, 16 Sep 2003 23:46:12 GMT

Powered by phpBB® Forum Software

campbellwasither.blogspot.com

Source: http://computer-programming-forum.com/2-vfp/42039d8f4f3108a3.htm

0 Response to "Vfp Do While Found Continue Code"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel