Dcount VS Count OI4.13 (OpenInsight 32-Bit)
At 17 APR 2003 10:30:42AM Pascal Landry wrote:
Is there a reason why I cannot do the following with dcount?
for i=dcount(var,@fm) to 1 step -1
*proc//the above line will work with count(var,@fm) + (var ne '') but not with dcountnext i
this one works fine for i=1 to dcount(var,@fm) **proc as does the count procedure
next i
it also has come to my attention that you actualy need to declare the "dcount" function, as for "count", there is no need to declare it.
Thanks,
Pascal Landry
At 17 APR 2003 12:38PM Richard Hunt wrote:
Pascal,
I agree with your statements. I have no real good answers to your questions.
I do want to offer some programming techniques on the "FOR" statement.
You should simplify the variables within the "FOR" statement, since they are checked for every loop.
"for i=dcount(var,@fm) to 1 step -1"
I would suggest this…
START_I=DCOUNT(VAR,@FM)
FOR 1=START_I TO 1 STEP -1
"for i=1 to dcount(var,@fm)"
I would suggest this…
END_I=DCOUNT(VAR,@FM)
FOR I=1 TO END_I
Unless you are changing the "VAR" variable during the loop, the above suggestions will work. Also, I do understand and I agree that your statements should work too.
At 17 APR 2003 02:04PM Pascal Landry wrote:
Thinking about what you said, I agree that and it makes sense that you should use for with a fixed variable. It's something I already do most of the time, but will be doing it all the time now.
Thanks for the advice.
Pascal Landry