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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with variables

Status
Not open for further replies.
Apr 9, 2010
3
US
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.
 
what is the criteria to export the data? are you pulling the data out of the table (the dbf file)?

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
 
Yes I am pulling data out of the dbf file to a text file
Thanks I will give it a try

Dan
 
Howdy Ali
Dbase IV does not know what "for lnIndex" is.
Did you give me code for Dbase IV?
Thanks
Dan
 
Code:
FOR xx = 1 TO 30
  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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top