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

locating a particular field name for a repalce statement

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I'm sure I had some code somewhere for this but I can't find it.

I have a loop in my code in which I open a set of tables one by one.

By manipulating the alias of the opened table I find a 'code' - say 'ZZ'

Now I have a storage table containing two fields relating to table ZZ in which I wish to add certain data.

One field is S_ZZ the other is R_ZZ. The first will contain the physical size of the dbf table and the latter the number of records. ( Someone else's requirements)

Having the code 'ZZ' in a variable, how do I locate/write the Replace statement for these fields pleaze?

If n1 is the size of the dbf in bytes and n2 is the number of records

I need to form REPL FIELD S_ZZ with n1 and REPL FIELD R_ZZ with n2

Thanks in advance

Gendev

 
You appear to already know how to write the replace command you've already written. What is it you're trying to figure out?

What table is open? See DBF() (or Alias()). What fields are in the table? See Afields(). (or a FOR loop from 1 to Fcount() looking at Field(n))

What are you really asking here?
 
Dan,

I was concerned that my construction of the fieldname variable was not working but it now is so thankyou for your interest.

GenDev
 
I need to form REPL FIELD S_ZZ with n1 and REPL FIELD R_ZZ with n2

The REPLACE command doesn't take a FIELD clause. You just need to do this:

[tt]REPLACE S_ZZ WITH n1, R_ZZ WITH n2[/tt]

(not REPLACE FIELD ...)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top