preethish
8th March 2011, 14:01
Hi,

I have to insert a record to a table in script.can Some one tell me how to do it.


Example. for a perticular consignment i have to insert a record to (max position +1) for tat consignment, I mean if xyz consingment is having 8 position under it. I have to insert a record to 9th position for the same consignment.

help me out.......:):(

Preethish

alakananda12
29th April 2011, 09:48
Hi,

I am writing the dummy query for you

Taking the pono as position field and cono as consignment field.
-------------------------------------------------------------
select max(tablename.pono):max.pono
from tablename
where tabllename._index1 = {:tablename.cono}
selectdo
endselect

tablename.pono = max.pono + 1
|* assign the required values to insert in other fields as per your requirement
---------
------
db.insert(tablename,db.retry)

if e then
message("e=%d",e)
abort.transaction()
else
commit.transaction()
endif

-----------------------------------------------
Regards,
Alka

darpan
3rd May 2011, 13:28
hi Preetish,

The Query written by Alka is perfect one thing i noticed very few poeple use the exception code they usually belive that it will get inserted.



"
if e then
message("e=%d",e)
abort.transaction()
else
commit.transaction()
endif
"
Nice....

Best Regards

Darpan
Hi,

I am writing the dummy query for you

Taking the pono as position field and cono as consignment field.
-------------------------------------------------------------
select max(tablename.pono):max.pono
from tablename
where tabllename._index1 = {:tablename.cono}
selectdo
endselect

tablename.pono = max.pono + 1
|* assign the required values to insert in other fields as per your requirement
---------
------
db.insert(tablename,db.retry)

if e then
message("e=%d",e)
abort.transaction()
else
commit.transaction()
endif

-----------------------------------------------
Regards,
Alka

preethish
4th May 2011, 07:13
Hi,

I am writing the dummy query for you

Taking the pono as position field and cono as consignment field.
-------------------------------------------------------------
select max(tablename.pono):max.pono
from tablename
where tabllename._index1 = {:tablename.cono}
selectdo
endselect

tablename.pono = max.pono + 1
|* assign the required values to insert in other fields as per your requirement
---------
------
db.insert(tablename,db.retry)

if e then
message("e=%d",e)
abort.transaction()
else
commit.transaction()
endif

-----------------------------------------------
Regards,
Alka

hi Alka,

Thanks for the help.

regards,
Preethish