dbTalk Databases Forums  

Using FIELD() to get field contents in FoxPro2.6?

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Using FIELD() to get field contents in FoxPro2.6? in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jason
 
Posts: n/a

Default Using FIELD() to get field contents in FoxPro2.6? - 01-23-2004 , 05:09 PM






Hi!

In my program, I don't know the name of the field I want to modify, but I
know it's number. I want to do this:

FieldNo=2
REPL field(FieldNo) with field(FieldNo)+10

but of course it returns a syntax error, because field(FieldNo) returns the
field name, not the contents.

Please - does anyone know a way around this? Any ideas much appreciated!!

Jason



Reply With Quote
  #2  
Old   
lemmebe@frednwilma.com
 
Posts: n/a

Default Re: Using FIELD() to get field contents in FoxPro2.6? - 01-23-2004 , 05:33 PM






On Fri, 23 Jan 2004 23:09:34 -0000, "Jason" <jason (AT) bluetattoo (DOT) co.uk> wrote:

Try this:

cFld = Field(FieldNo)
Replace &cFld with Eval(cFld) + 10

Alan


Quote:
Hi!

In my program, I don't know the name of the field I want to modify, but I
know it's number. I want to do this:

FieldNo=2
REPL field(FieldNo) with field(FieldNo)+10

but of course it returns a syntax error, because field(FieldNo) returns the
field name, not the contents.

Please - does anyone know a way around this? Any ideas much appreciated!!

Jason

My real address is alan at sprint dot ca
(with a 'p' on 'alan' making it 'alanp',
and no spaces). I'm sick of email spam.


Reply With Quote
  #3  
Old   
Jeroen van Kalken
 
Posts: n/a

Default Re: Using FIELD() to get field contents in FoxPro2.6? - 01-23-2004 , 05:55 PM



On Fri, 23 Jan 2004 23:09:34 -0000, "Jason" <jason (AT) bluetattoo (DOT) co.uk>
wrote:

Quote:
Hi!

In my program, I don't know the name of the field I want to modify, but I
know it's number. I want to do this:

FieldNo=2
REPL field(FieldNo) with field(FieldNo)+10
repl (field(fieldno)) with eval(field(fieldno))+10

minutly faster would be (and slightly more readable):

lcFieldName=field(FieldNo)
repl (lcFieldName) with eval(lcFieldName)+10

Quote:
but of course it returns a syntax error, because field(FieldNo) returns the
field name, not the contents.

Please - does anyone know a way around this? Any ideas much appreciated!!

Jason



Reply With Quote
  #4  
Old   
Jason
 
Posts: n/a

Default Re: Using FIELD() to get field contents in FoxPro2.6? - 01-24-2004 , 04:04 AM



Thanks guys!

"Jason" <jason (AT) bluetattoo (DOT) co.uk> wrote

Quote:
Hi!

In my program, I don't know the name of the field I want to modify, but I
know it's number. I want to do this:

FieldNo=2
REPL field(FieldNo) with field(FieldNo)+10

but of course it returns a syntax error, because field(FieldNo) returns
the
field name, not the contents.

Please - does anyone know a way around this? Any ideas much appreciated!!

Jason





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.