VFP9SP2
I'm retrofitting old code and need to identify if the field's IID field in AutoInc or not. Looks like AFIELDS() is my friend here for array elements 17 and 18. Just wondered if anyone else had a better way?
Thanks. --Mike
On Thu, 27 Jul 2017, at 11:49 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
VFP9SP2
I'm retrofitting old code and need to identify if the field's IID field in AutoInc or not. Looks like AFIELDS() is my friend here for array elements 17 and 18. Just wondered if anyone else had a better way?
I think that's probably the path of least resistance.
can you add a row to the table to see which one auto populates?
On Thu, Jul 27, 2017 at 7:41 AM, Alan Bourke alanpbourke@fastmail.fm wrote:
On Thu, 27 Jul 2017, at 11:49 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
VFP9SP2
I'm retrofitting old code and need to identify if the field's IID field in AutoInc or not. Looks like AFIELDS() is my friend here for array elements 17 and 18. Just wondered if anyone else had a better way?
I think that's probably the path of least resistance.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
On 2017-07-27 09:43, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
On 2017-07-27 09:29, Stephen Russell wrote:
can you add a row to the table to see which one auto populates?
The VFP Help file states that 17 is the NextValue for autoincrementing and 18 is the Step for autoincrementing.
And then I'm getting the new value via this way after the INSERT INTO: liKey = GETAUTOINCVALUE(0)
(...in case others wondered)
As I understand it you need to check if a field is autoinc or not.
You could use afields(), and in the resulting array if element [x, 2] is "I" and element [x, 18] > 0 then you can safely say that field is autoinc.
Or do
copy structure extended to temp.dbf
Then scan temp.dbf for records where field_type= "I" and field_step or field_next are > 0.
But that's more faff.
On 2017-07-27 10:04, Alan Bourke wrote:
As I understand it you need to check if a field is autoinc or not.
You could use afields(), and in the resulting array if element [x, 2] is "I" and element [x, 18] > 0 then you can safely say that field is autoinc.
Right....that's what I'm doing.
Would there ever be a case where element[x,18] > 0 and element[x,2] <> 'I'?
Or is the test on element[x,2] a "safety check"?
Paul H. Tarver Tarver Program Consultants, Inc. Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Alan Bourke Sent: Thursday, July 27, 2017 9:04 AM To: profoxtech@leafe.com Subject: Re: Determining VFP field to be AutoInc or not
As I understand it you need to check if a field is autoinc or not.
You could use afields(), and in the resulting array if element [x, 2] is "I" and element [x, 18] > 0 then you can safely say that field is autoinc.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
On Thu, 27 Jul 2017, at 11:49 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
VFP9SP2
I'm retrofitting old code and need to identify if the field's IID field in AutoInc or not. Looks like AFIELDS() is my friend here for array elements 17 and 18. Just wondered if anyone else had a better way?
Thanks. --Mike
[excessive quoting removed by server]
On 2017-07-27 11:17, Paul H. Tarver wrote:
Would there ever be a case where element[x,18] > 0 and element[x,2] <> 'I'?
Or is the test on element[x,2] a "safety check"?
Actually, I'm sorry...I didn't tell the list I'm looking a few lines up from that for the "IID" field, which is consistent in all of my tables for this project (...so I'm not just arbitrarily looking at ANY field in the table).