Help with variables
Help with variables
(OP)
Howdy,
I use to write code with Dbase VI way back when. Problem is I have forgotten almost all that I learned.
I need help with a uniqe variable, maybe it can't be done. I have data on flight plans that I want to export out into a text file. The code is as follows.
DO WHILE .NOT. EOF()
NUM = 0
SET ALTERNATE ON
?RTRIM(AC) + "," + TRIM(REG) + ","
DO WHILE NUM = 0
??LTRIM(STR(CA1)) + "," + RTRIM(FR1)
??LRTIM(STR(CA2)) + "," + RTRIM(FR2)
Num = 1
AND SO ON.
My problem is that there are 185 feilds. There are CA1 and CA2 up to CA30. The same with FR1 and FR2 and six more feilds named like that.
My question is how can I use a variable or variables to replace the 1 & 2 & 3 in the CA1.
I hope this is clear enough
Thanks for any help.
I use to write code with Dbase VI way back when. Problem is I have forgotten almost all that I learned.
I need help with a uniqe variable, maybe it can't be done. I have data on flight plans that I want to export out into a text file. The code is as follows.
DO WHILE .NOT. EOF()
NUM = 0
SET ALTERNATE ON
?RTRIM(AC) + "," + TRIM(REG) + ","
DO WHILE NUM = 0
??LTRIM(STR(CA1)) + "," + RTRIM(FR1)
??LRTIM(STR(CA2)) + "," + RTRIM(FR2)
Num = 1
AND SO ON.
My problem is that there are 185 feilds. There are CA1 and CA2 up to CA30. The same with FR1 and FR2 and six more feilds named like that.
My question is how can I use a variable or variables to replace the 1 & 2 & 3 in the CA1.
I hope this is clear enough
Thanks for any help.
RE: Help with variables
to use name replacement, use the & sign.
for lnIndex = 1 to 30
y = alltrim(str(lnIndex))
?? CA&y
next
**** that would print
value of the fields:
CA1,2,3,...30
is to open the table, and use the [copy to] command...
Ali Koumaiha
TeknoSoft Inc.
Michigan
RE: Help with variables
Thanks I will give it a try
Dan
RE: Help with variables
Dbase IV does not know what "for lnIndex" is.
Did you give me code for Dbase IV?
Thanks
Dan
RE: Help with variables
CODE
yy = LTRIM(STR(xx))
?? EVALUATE("yy")
NEXT
FOR/NEXT is a loop structure.
lnIndex is just the variable name to which the sequential numbers 1 to 30 are assigned in the loop. In my example above I have substituted variable names xx and yy.