I am cloning a record from a table to the same table. The id field is autoincremented correctly according to the field rule. Here's what I want to happen:
Initially the user is on the detail view of a grid, which is displayed separately from the grid, when s(he) initiates the a5w page which contains the cloning. I want the user to be sent back to this detail view with the new, cloned record showing. I do not know how to capture the new id value nor to write the response.redirect line.
This is what is on the a5w page:
dim vid as c
dim newvid as c
dim src as p
dim dest as p
dim indx1 as p
'Open a src first instance of the table
src=table.open("[PathAlias.ADB_Path]\productstest")
'Open a trg second instance of the same table
dest=table.open("[PathAlias.ADB_Path]\productstest")
'Set its index to id order
indx1=src.index_primary_put("id")
'Find the specific record
src.fetch_find(vid)
'Put dest into enter mode and clone record from the src
dest.enter_begin(.T.)
dest.record_clone(src)
'This next line shows that dest.id and src.id are = at this point
'newvid=dest.id
dest.enter_end(.T.)
'This next line shows that the dest.id doesn't transfer to newvid
'newvid=dest.id
dest.close()
src.close()
'send user to the prod_detailview of this cloned record
'This line brings the user to the grid part but not the detail part.
response.redirect("productstest.a5w")
So, when does the id field rule fire? And how do I get that new value. Then how do I use it in a response.redirect statement?
Any help would be appreciated.
Dorothy
Initially the user is on the detail view of a grid, which is displayed separately from the grid, when s(he) initiates the a5w page which contains the cloning. I want the user to be sent back to this detail view with the new, cloned record showing. I do not know how to capture the new id value nor to write the response.redirect line.
This is what is on the a5w page:
dim vid as c
dim newvid as c
dim src as p
dim dest as p
dim indx1 as p
'Open a src first instance of the table
src=table.open("[PathAlias.ADB_Path]\productstest")
'Open a trg second instance of the same table
dest=table.open("[PathAlias.ADB_Path]\productstest")
'Set its index to id order
indx1=src.index_primary_put("id")
'Find the specific record
src.fetch_find(vid)
'Put dest into enter mode and clone record from the src
dest.enter_begin(.T.)
dest.record_clone(src)
'This next line shows that dest.id and src.id are = at this point
'newvid=dest.id
dest.enter_end(.T.)
'This next line shows that the dest.id doesn't transfer to newvid
'newvid=dest.id
dest.close()
src.close()
'send user to the prod_detailview of this cloned record
'This line brings the user to the grid part but not the detail part.
response.redirect("productstest.a5w")
So, when does the id field rule fire? And how do I get that new value. Then how do I use it in a response.redirect statement?
Any help would be appreciated.
Dorothy
Comment