Index
2008-12-27 22:38Matt Slay : Help with GATHER and AutoInc fields
2008-12-28 16:26Jack Skelley : RE: Help with GATHER and AutoInc fields
2008-12-28 16:29Rick Borup : RE: Help with GATHER and AutoInc fields
2008-12-28 17:39Gianni Turri : Re: Help with GATHER and AutoInc fields
2008-12-29 06:14Rafael Copquin : Re: Help with GATHER and AutoInc fields
2008-12-29 06:17Rafael Copquin : Fw: Help with GATHER and AutoInc fields
2008-12-29 06:21Ajoy Khaund : Re: Help with GATHER and AutoInc fields
2008-12-29 06:27Rafael Copquin : Re: Help with GATHER and AutoInc fields
Back to top
Help with GATHER and AutoInc fields

Author: Matt Slay

Posted: 2008-12-27 22:38:34   Link

Need some guidance here... I am trying to copy the data in one record

to a new record in the same table, then change the JobNo field to some

new Job umber that I already have and validated as unique.

The problem is that the table has an AutoInc field named "ipkey", and

VFP does not want to let me do a GATHER for obvious reasons.

So, I understand why it has this limitation because of autoinc, I just

want to know how one normally works around it.

Presently, to get around it, I am doing a REPLACE command on every

field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

NAME method to avoid having to list out every field, and so I would

have code that is independent of the field names.

Here's what I wanted to use:

Select 0

Use Jobs order jobno

... navigate to the desired record ..

SCATTER NAME loCurrentJob

Append Blank

Gather NAME loCurrentJob

replace JobNo with lcNewJobNo && a passed in value, already validated

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

©2008 Matt Slay
Back to top
RE: Help with GATHER and AutoInc fields

Author: Jack Skelley

Posted: 2008-12-28 16:26:53   Link

Matt:

Why don't you...=20

**select your record...

SCATTER NAME loCurrentJob=20

loCurrentJob.JobNo =3D lcNewJobNo

INSERT INTO Jobs FROM NAME loCurrentJob

Regards,

Jack Skelley

________________________________________

From: profoxtech-bounces@leafe.com [profoxtech-bounces@leafe.com] On Behalf=

Of Matt Slay [foxstuff@jordanmachine.com]

Sent: Saturday, December 27, 2008 10:38 PM

To: profoxtech@leafe.com

Subject: Help with GATHER and AutoInc fields

Need some guidance here... I am trying to copy the data in one record

to a new record in the same table, then change the JobNo field to some

new Job umber that I already have and validated as unique.

The problem is that the table has an AutoInc field named "ipkey", and

VFP does not want to let me do a GATHER for obvious reasons.

So, I understand why it has this limitation because of autoinc, I just

want to know how one normally works around it.

Presently, to get around it, I am doing a REPLACE command on every

field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

NAME method to avoid having to list out every field, and so I would

have code that is independent of the field names.

Here's what I wanted to use:

Select 0

Use Jobs order jobno

... navigate to the desired record ..

SCATTER NAME loCurrentJob

Append Blank

Gather NAME loCurrentJob

replace JobNo with lcNewJobNo && a passed in value, already validated

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2008 Jack Skelley
Back to top
RE: Help with GATHER and AutoInc fields

Author: Rick Borup

Posted: 2008-12-28 16:29:55   Link

Hi Matt,

You can GATHER NAME loCurrentJob FIELDS EXCEPT ipkey.

-Rick

-----Original Message-----

From: profoxtech-bounces@leafe.com [mailto:profoxtech-bounces@leafe.com] On

Behalf Of Matt Slay

Sent: Saturday, December 27, 2008 9:39 PM

To: profoxtech@leafe.com

Subject: Help with GATHER and AutoInc fields

Need some guidance here... I am trying to copy the data in one record

to a new record in the same table, then change the JobNo field to some

new Job umber that I already have and validated as unique.

The problem is that the table has an AutoInc field named "ipkey", and

VFP does not want to let me do a GATHER for obvious reasons.

So, I understand why it has this limitation because of autoinc, I just

want to know how one normally works around it.

Presently, to get around it, I am doing a REPLACE command on every

field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

NAME method to avoid having to list out every field, and so I would

have code that is independent of the field names.

Here's what I wanted to use:

Select 0

Use Jobs order jobno

... navigate to the desired record ..

SCATTER NAME loCurrentJob

Append Blank

Gather NAME loCurrentJob

replace JobNo with lcNewJobNo && a passed in value, already validated

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2008 Rick Borup
Back to top
Re: Help with GATHER and AutoInc fields

Author: Gianni Turri

Posted: 2008-12-28 17:39:09   Link

Here VFP9 SP1.

Take a look at

set AUTOINCERROR OFF

Using it you no more have the need to bother writing on the autoinc =

field, because it is read-only.

So you can continue to use your familiar gather istruction.

--=20

Gianni

On Sat, 27 Dec 2008 21:38:34 -0600, Matt Slay =

<foxstuff@jordanmachine.com> wrote:

>Need some guidance here... I am trying to copy the data in one record =20

>to a new record in the same table, then change the JobNo field to some =20

>new Job umber that I already have and validated as unique.

>

>The problem is that the table has an AutoInc field named "ipkey", and =20

>VFP does not want to let me do a GATHER for obvious reasons.

>

>So, I understand why it has this limitation because of autoinc, I just =20

>want to know how one normally works around it.

>

>Presently, to get around it, I am doing a REPLACE command on every =20

>field except ipkey, but I was hoping to use the SCATTER NAME / GATHER =20

>NAME method to avoid having to list out every field, and so I would =20

>have code that is independent of the field names.

>

>Here's what I wanted to use:

>

>Select 0

>Use Jobs order jobno

>... navigate to the desired record ..

>SCATTER NAME loCurrentJob

>Append Blank

>Gather NAME loCurrentJob

>replace JobNo with lcNewJobNo && a passed in value, already validated

>

>

>

>

>--- StripMime Report -- processed MIME parts ---

>multipart/alternative

> text/plain (text body -- kept)

> text/html

>---

>

[excessive quoting removed by server]

©2008 Gianni Turri
Back to top
Re: Help with GATHER and AutoInc fields

Author: Rafael Copquin

Posted: 2008-12-29 06:14:37   Link

The problem you are facing is that VFP does not let you replace an autoinc

field because it is readonly.

There are two ways to do a gather, in the scenario you are posting here:

a) check the VFP help for set autoincerror ( I do not use it at all)

b) use gather name

The customers table has an autoincrementing field (custid) that I use as the

PK for that table. When I need to make changes to a certain record, gather

is the command of choice. Here's how I do this:

select Customers

gather name oCustomers memo blank && create an object with empty

properties (fields)

removeproperty(oCustomers,'custid')

that is, remove from the object oCustomer, the property (field) that is an

autoincrementing field

then proceed to make changes as necessary in the object's properties

with oCustomers

.name = 'John Doe'

.address = '223 Main St.'

etc.

endwith

gather name oCustomers

This will replace the corresponding fields in the record with the objects's

properties as above. Because you have removed the custid property (which is

an autoincrementing field) from the object, you do not touch that field in

the table, and your gather command replaces all other fields, just as the

old gather memvar command did.

BTW, you can use the same technique with the insert command, simply by

replacing the gather name line above with:

insert into customers from name oCustomers

Since you are not attempting to replace the autoinc field with anything, it

will just operate by itself, incrementing the fields value automatically and

allowing a new record to be added.

Happy New Year

Rafael Copquin

----- Original Message -----

From: "Matt Slay" <foxstuff@jordanmachine.com>

To: <profoxtech@leafe.com>

Sent: Sunday, December 28, 2008 1:38 AM

Subject: Help with GATHER and AutoInc fields

> Need some guidance here... I am trying to copy the data in one record

> to a new record in the same table, then change the JobNo field to some

> new Job umber that I already have and validated as unique.

>

> The problem is that the table has an AutoInc field named "ipkey", and

> VFP does not want to let me do a GATHER for obvious reasons.

>

> So, I understand why it has this limitation because of autoinc, I just

> want to know how one normally works around it.

>

> Presently, to get around it, I am doing a REPLACE command on every

> field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

> NAME method to avoid having to list out every field, and so I would

> have code that is independent of the field names.

>

> Here's what I wanted to use:

>

> Select 0

> Use Jobs order jobno

> ... navigate to the desired record ..

> SCATTER NAME loCurrentJob

> Append Blank

> Gather NAME loCurrentJob

> replace JobNo with lcNewJobNo && a passed in value, already validated

>

>

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

©2008 Rafael Copquin
Back to top
Fw: Help with GATHER and AutoInc fields

Author: Rafael Copquin

Posted: 2008-12-29 06:17:34   Link

Sorry I made a gross mistake:

the line should be scatter name, not gather name, when you create the object

scatter name oCustomers memo blank

(two much champagne during the Christmas celebrations)

Rafael Copquin

----- Original Message -----

From: "Rafael Copquin" <rcopquin@ciudad.com.ar>

To: <profox@leafe.com>

Sent: Monday, December 29, 2008 9:14 AM

Subject: Re: Help with GATHER and AutoInc fields

> The problem you are facing is that VFP does not let you replace an autoinc

> field because it is readonly.

>

> There are two ways to do a gather, in the scenario you are posting here:

>

> a) check the VFP help for set autoincerror ( I do not use it at all)

>

> b) use gather name

>

> The customers table has an autoincrementing field (custid) that I use as

> the PK for that table. When I need to make changes to a certain record,

> gather is the command of choice. Here's how I do this:

>

> select Customers

> gather name oCustomers memo blank && create an object with empty

> properties (fields)

>

> removeproperty(oCustomers,'custid')

>

> that is, remove from the object oCustomer, the property (field) that is an

> autoincrementing field

> then proceed to make changes as necessary in the object's properties

>

> with oCustomers

> .name = 'John Doe'

> .address = '223 Main St.'

>

> etc.

> endwith

>

> gather name oCustomers

>

> This will replace the corresponding fields in the record with the

> objects's properties as above. Because you have removed the custid

> property (which is an autoincrementing field) from the object, you do not

> touch that field in the table, and your gather command replaces all other

> fields, just as the old gather memvar command did.

>

> BTW, you can use the same technique with the insert command, simply by

> replacing the gather name line above with:

>

> insert into customers from name oCustomers

>

> Since you are not attempting to replace the autoinc field with anything,

> it will just operate by itself, incrementing the fields value

> automatically and allowing a new record to be added.

>

> Happy New Year

>

> Rafael Copquin

>

>

>

>

>

>

> ----- Original Message -----

> From: "Matt Slay" <foxstuff@jordanmachine.com>

> To: <profoxtech@leafe.com>

> Sent: Sunday, December 28, 2008 1:38 AM

> Subject: Help with GATHER and AutoInc fields

>

>

>> Need some guidance here... I am trying to copy the data in one record

>> to a new record in the same table, then change the JobNo field to some

>> new Job umber that I already have and validated as unique.

>>

>> The problem is that the table has an AutoInc field named "ipkey", and

>> VFP does not want to let me do a GATHER for obvious reasons.

>>

>> So, I understand why it has this limitation because of autoinc, I just

>> want to know how one normally works around it.

>>

>> Presently, to get around it, I am doing a REPLACE command on every

>> field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

>> NAME method to avoid having to list out every field, and so I would

>> have code that is independent of the field names.

>>

>> Here's what I wanted to use:

>>

>> Select 0

>> Use Jobs order jobno

>> ... navigate to the desired record ..

>> SCATTER NAME loCurrentJob

>> Append Blank

>> Gather NAME loCurrentJob

>> replace JobNo with lcNewJobNo && a passed in value, already validated

>>

>>

>>

>>

>> --- StripMime Report -- processed MIME parts ---

>> multipart/alternative

>> text/plain (text body -- kept)

>> text/html

>> ---

>>

[excessive quoting removed by server]

©2008 Rafael Copquin
Back to top
Re: Help with GATHER and AutoInc fields

Author: Ajoy Khaund

Posted: 2008-12-29 06:21:12   Link

wow you are quick. I was reading it just now and realized it was a typo.

Great

Ajoy Khaund

Neamati Road

Near Bhogdoi Bridge

Jorhat 785001-21

Assam, India

Tel: 91-376-2351288

Cell: 91-94350-92287

Mail: akhaund@hotmail.com

Mail: akhaund@gmail.com

"Walking on water and developing software from a specification are easy if

both are frozen."

- Edward V. Berard, "Life-Cycle Approaches"

--------------------------------------------------

From: "Rafael Copquin" <rcopquin@ciudad.com.ar>

Sent: Monday, December 29, 2008 4:47 PM

To: <profoxtech@leafe.com>

Subject: Fw: Help with GATHER and AutoInc fields

> Sorry I made a gross mistake:

>

> the line should be scatter name, not gather name, when you create the

> object

>

> scatter name oCustomers memo blank

>

> (two much champagne during the Christmas celebrations)

>

> Rafael Copquin

>

> ----- Original Message -----

> From: "Rafael Copquin" <rcopquin@ciudad.com.ar>

> To: <profox@leafe.com>

> Sent: Monday, December 29, 2008 9:14 AM

> Subject: Re: Help with GATHER and AutoInc fields

>

>

>> The problem you are facing is that VFP does not let you replace an

>> autoinc

>> field because it is readonly.

>>

>> There are two ways to do a gather, in the scenario you are posting here:

>>

>> a) check the VFP help for set autoincerror ( I do not use it at all)

>>

>> b) use gather name

>>

>> The customers table has an autoincrementing field (custid) that I use as

>> the PK for that table. When I need to make changes to a certain record,

>> gather is the command of choice. Here's how I do this:

>>

>> select Customers

>> gather name oCustomers memo blank && create an object with empty

>> properties (fields)

>>

>> removeproperty(oCustomers,'custid')

>>

>> that is, remove from the object oCustomer, the property (field) that is

>> an

>> autoincrementing field

>> then proceed to make changes as necessary in the object's properties

>>

>> with oCustomers

>> .name = 'John Doe'

>> .address = '223 Main St.'

>>

>> etc.

>> endwith

>>

>> gather name oCustomers

>>

>> This will replace the corresponding fields in the record with the

>> objects's properties as above. Because you have removed the custid

>> property (which is an autoincrementing field) from the object, you do not

>> touch that field in the table, and your gather command replaces all other

>> fields, just as the old gather memvar command did.

>>

>> BTW, you can use the same technique with the insert command, simply by

>> replacing the gather name line above with:

>>

>> insert into customers from name oCustomers

>>

>> Since you are not attempting to replace the autoinc field with anything,

>> it will just operate by itself, incrementing the fields value

>> automatically and allowing a new record to be added.

>>

>> Happy New Year

>>

>> Rafael Copquin

>>

>>

>>

>>

>>

>>

>> ----- Original Message -----

>> From: "Matt Slay" <foxstuff@jordanmachine.com>

>> To: <profoxtech@leafe.com>

>> Sent: Sunday, December 28, 2008 1:38 AM

>> Subject: Help with GATHER and AutoInc fields

>>

>>

>>> Need some guidance here... I am trying to copy the data in one record

>>> to a new record in the same table, then change the JobNo field to some

>>> new Job umber that I already have and validated as unique.

>>>

>>> The problem is that the table has an AutoInc field named "ipkey", and

>>> VFP does not want to let me do a GATHER for obvious reasons.

>>>

>>> So, I understand why it has this limitation because of autoinc, I just

>>> want to know how one normally works around it.

>>>

>>> Presently, to get around it, I am doing a REPLACE command on every

>>> field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

>>> NAME method to avoid having to list out every field, and so I would

>>> have code that is independent of the field names.

>>>

>>> Here's what I wanted to use:

>>>

>>> Select 0

>>> Use Jobs order jobno

>>> ... navigate to the desired record ..

>>> SCATTER NAME loCurrentJob

>>> Append Blank

>>> Gather NAME loCurrentJob

>>> replace JobNo with lcNewJobNo && a passed in value, already validated

>>>

>>>

>>>

>>>

>>> --- StripMime Report -- processed MIME parts ---

>>> multipart/alternative

>>> text/plain (text body -- kept)

>>> text/html

>>> ---

>>>

[excessive quoting removed by server]

©2008 Ajoy Khaund
Back to top
Re: Help with GATHER and AutoInc fields

Author: Rafael Copquin

Posted: 2008-12-29 06:27:27   Link

Even though it is Monday morning!

Take care

Rafael

----- Original Message -----

From: "Ajoy Khaund" <akhaund@gmail.com>

To: <profoxtech@leafe.com>

Sent: Monday, December 29, 2008 9:21 AM

Subject: Re: Help with GATHER and AutoInc fields

> wow you are quick. I was reading it just now and realized it was a typo.

>

> Great

>

>

> Ajoy Khaund

> Neamati Road

> Near Bhogdoi Bridge

> Jorhat 785001-21

> Assam, India

>

> Tel: 91-376-2351288

> Cell: 91-94350-92287

> Mail: akhaund@hotmail.com

> Mail: akhaund@gmail.com

>

> "Walking on water and developing software from a specification are easy if

> both are frozen."

> - Edward V. Berard, "Life-Cycle Approaches"

>

> --------------------------------------------------

> From: "Rafael Copquin" <rcopquin@ciudad.com.ar>

> Sent: Monday, December 29, 2008 4:47 PM

> To: <profoxtech@leafe.com>

> Subject: Fw: Help with GATHER and AutoInc fields

>

>> Sorry I made a gross mistake:

>>

>> the line should be scatter name, not gather name, when you create the

>> object

>>

>> scatter name oCustomers memo blank

>>

>> (two much champagne during the Christmas celebrations)

>>

>> Rafael Copquin

>>

>> ----- Original Message -----

>> From: "Rafael Copquin" <rcopquin@ciudad.com.ar>

>> To: <profox@leafe.com>

>> Sent: Monday, December 29, 2008 9:14 AM

>> Subject: Re: Help with GATHER and AutoInc fields

>>

>>

>>> The problem you are facing is that VFP does not let you replace an

>>> autoinc

>>> field because it is readonly.

>>>

>>> There are two ways to do a gather, in the scenario you are posting here:

>>>

>>> a) check the VFP help for set autoincerror ( I do not use it at all)

>>>

>>> b) use gather name

>>>

>>> The customers table has an autoincrementing field (custid) that I use as

>>> the PK for that table. When I need to make changes to a certain record,

>>> gather is the command of choice. Here's how I do this:

>>>

>>> select Customers

>>> gather name oCustomers memo blank && create an object with empty

>>> properties (fields)

>>>

>>> removeproperty(oCustomers,'custid')

>>>

>>> that is, remove from the object oCustomer, the property (field) that is

>>> an

>>> autoincrementing field

>>> then proceed to make changes as necessary in the object's properties

>>>

>>> with oCustomers

>>> .name = 'John Doe'

>>> .address = '223 Main St.'

>>>

>>> etc.

>>> endwith

>>>

>>> gather name oCustomers

>>>

>>> This will replace the corresponding fields in the record with the

>>> objects's properties as above. Because you have removed the custid

>>> property (which is an autoincrementing field) from the object, you do

>>> not

>>> touch that field in the table, and your gather command replaces all

>>> other

>>> fields, just as the old gather memvar command did.

>>>

>>> BTW, you can use the same technique with the insert command, simply by

>>> replacing the gather name line above with:

>>>

>>> insert into customers from name oCustomers

>>>

>>> Since you are not attempting to replace the autoinc field with anything,

>>> it will just operate by itself, incrementing the fields value

>>> automatically and allowing a new record to be added.

>>>

>>> Happy New Year

>>>

>>> Rafael Copquin

>>>

>>>

>>>

>>>

>>>

>>>

>>> ----- Original Message -----

>>> From: "Matt Slay" <foxstuff@jordanmachine.com>

>>> To: <profoxtech@leafe.com>

>>> Sent: Sunday, December 28, 2008 1:38 AM

>>> Subject: Help with GATHER and AutoInc fields

>>>

>>>

>>>> Need some guidance here... I am trying to copy the data in one record

>>>> to a new record in the same table, then change the JobNo field to some

>>>> new Job umber that I already have and validated as unique.

>>>>

>>>> The problem is that the table has an AutoInc field named "ipkey", and

>>>> VFP does not want to let me do a GATHER for obvious reasons.

>>>>

>>>> So, I understand why it has this limitation because of autoinc, I just

>>>> want to know how one normally works around it.

>>>>

>>>> Presently, to get around it, I am doing a REPLACE command on every

>>>> field except ipkey, but I was hoping to use the SCATTER NAME / GATHER

>>>> NAME method to avoid having to list out every field, and so I would

>>>> have code that is independent of the field names.

>>>>

>>>> Here's what I wanted to use:

>>>>

>>>> Select 0

>>>> Use Jobs order jobno

>>>> ... navigate to the desired record ..

>>>> SCATTER NAME loCurrentJob

>>>> Append Blank

>>>> Gather NAME loCurrentJob

>>>> replace JobNo with lcNewJobNo && a passed in value, already validated

>>>>

>>>>

>>>>

>>>>

>>>> --- StripMime Report -- processed MIME parts ---

>>>> multipart/alternative

>>>> text/plain (text body -- kept)

>>>> text/html

>>>> ---

>>>>

[excessive quoting removed by server]

©2008 Rafael Copquin