×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help with variables

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.

RE: Help with variables

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

RE: Help with variables

(OP)
Yes I am pulling data out of the dbf file to a text file
Thanks I will give it a try

Dan

RE: Help with variables

(OP)
Howdy Ali
Dbase IV does not know what "for lnIndex" is.
Did you give me code for Dbase IV?
Thanks
Dan

RE: Help with variables

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close