How do I make this kind of auto increment in alpha five when I use this code to duplciate a set?
The autoincrement should be based on a variable + a number. e.g. INV+000001, next is INV000002 etc.
My purpose in doing this is for future consolidation of data entry? the application will be distributed to different locations, they will have their own data entry based on their location, if one is lacated in MA then the inv no. will be MA000001,MA000002, and if one is located in NY then inv would be NY000001, NY000002. It would not create problems if records from MA and NY will be copied into a main database without primary key problems being mixed up.I will ask on another thread how to copy records from another location with the same database by using a USB device.
dim hdr as p
dim items as p
dim old_parent as b
dim count_items as n
dim i as n
hdr=table.current(1)
items=table.current(2)
count_items=count(inv_items->Inv_no,GRP->Inv_hdr)
if count_items>0 then
dim records[count_items] as b
i=0
items.fetch_first()
while i<count_items
i=i+1
records[i]=items.record_data_get()
items.fetch_next()
end while
end if
old_parent=hdr.record_data_get()
hdr.enter_begin()
hdr.record_data_set(old_parent)
hdr.enter_end(.t.)
if count_items>0 then
for i = 1 to count_items
items.enter_begin()
items.record_data_set(records[i])
items.inv_no=hdr.inv_no
items.enter_end(.t.)
next
end if
parent.resynch()
end
The autoincrement should be based on a variable + a number. e.g. INV+000001, next is INV000002 etc.
My purpose in doing this is for future consolidation of data entry? the application will be distributed to different locations, they will have their own data entry based on their location, if one is lacated in MA then the inv no. will be MA000001,MA000002, and if one is located in NY then inv would be NY000001, NY000002. It would not create problems if records from MA and NY will be copied into a main database without primary key problems being mixed up.I will ask on another thread how to copy records from another location with the same database by using a USB device.
dim hdr as p
dim items as p
dim old_parent as b
dim count_items as n
dim i as n
hdr=table.current(1)
items=table.current(2)
count_items=count(inv_items->Inv_no,GRP->Inv_hdr)
if count_items>0 then
dim records[count_items] as b
i=0
items.fetch_first()
while i<count_items
i=i+1
records[i]=items.record_data_get()
items.fetch_next()
end while
end if
old_parent=hdr.record_data_get()
hdr.enter_begin()
hdr.record_data_set(old_parent)
hdr.enter_end(.t.)
if count_items>0 then
for i = 1 to count_items
items.enter_begin()
items.record_data_set(records[i])
items.inv_no=hdr.inv_no
items.enter_end(.t.)
next
end if
parent.resynch()
end
Comment