Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I use the field() command in a replace statement.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00353285
Message ID:
00353291
Views:
21
You'll need to set a variable to hold the retun value of the Field() function.

For example:

cField = field(nCntr)
replace (cField) with alltrim(fgets(nFile))


>I am trying to write a generic import program where the user can select a table and specify a path and this program will read in the data.
>
>I am getting an error with my replace command.
>
>
>do while !feof(nFileHandle)
>  select &cTable
>  append blank
>  for nCntr = 1 to fcount(cTable)
>    do case
>      case type(field(nCntr)) = "C"
>	  replace eval(field(nCntr)) with alltrim(fgets(nFile))
>      case type(field(nCntr)) = "N"
>         replace field(nCntr) with val(fgets(nFile))
>       .
>       .
>       .
>      otherwise
>    endcase
>  endfor				
>enddo
>
>
>I've tried replace eval(field(nCntr)) with alltrim(fgets(nFile)) and replace field(ncntr) with alltrim(fgets(nFile))
>
>But I keep getting the error: "Phrase contains unrecognized phrase/keyword"
>
>Is there a way to do this?
>
>Thanks,
>Paul Acton
Henry Petry
AeroHunter.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform