Home > Archive > Programming with dBASE > June 2005 > Appending and AutoIncrement Problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Appending and AutoIncrement Problem
Jim Dutton

2005-06-23, 8:23 pm

I am trying to append a record from a previous year's table to the current table. I had been using the following for...endfor constructs:

aflds=new array()
for no=1 to qoldfile.rowset.fields.size
aflds.add(qoldfile.rowset.fields[no].value)
endfor

form.rowset.beginappend()
for no=1 to aflds.size
form.rowset.fields[no].value=aflds[no]
endfor

It worked fine until I added an autoincrement field. Naturally, when the procedure tries to add the record, it fails because the value for the autoincrement field in oldfile cannot be added to the new file. Perhaps I could add an if...endif construct wi
thin the for...endfor loop to skip the autoincrement field, but is there a simpler way? Thanks for any help.
Ken Mayer [dBVIPS]

2005-06-23, 8:23 pm

Jim Dutton wrote:
> I am trying to append a record from a previous year's table to the current table. I had been using the following for...endfor constructs:
>
> aflds=new array()
> for no=1 to qoldfile.rowset.fields.size
> aflds.add(qoldfile.rowset.fields[no].value)
> endfor
>
> form.rowset.beginappend()
> for no=1 to aflds.size
> form.rowset.fields[no].value=aflds[no]
> endfor
>
> It worked fine until I added an autoincrement field. Naturally, when the procedure tries to add the record, it fails because the value for the autoincrement field in oldfile cannot be added to the new file. Perhaps I could add an if...endif construct

within the for...endfor loop to skip the autoincrement field, but is there a simpler way? Thanks for any help.

for no=1 to aflds.size
if not form.rowset.fields[no].type == "AUTOINCREMENT"
form.rowset.fields[no].value=aflds[no]
endif
endfor

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
JIm Dutton

2005-06-24, 9:23 am

Many thanks for a simple solution,
Jim Dutton
============

Ken Mayer [dBVIPS] Wrote:

> Jim Dutton wrote:
t within the for...endfor loop to skip the autoincrement field, but is there a simpler way? Thanks for any help.[color=darkred]
>
> for no=1 to aflds.size
> if not form.rowset.fields[no].type == "AUTOINCREMENT"
> form.rowset.fields[no].value=aflds[no]
> endif
> endfor
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase


Ken Mayer [dBVIPS]

2005-06-27, 11:23 am

JIm Dutton wrote:
> Many thanks for a simple solution,


Glad to help. That one has bitten many of us at various points. <g>

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com