smusba
13th December 2010, 15:17
Dear Frends,

I want to update no of items at once . My query is below which is not working as expected.
functions:


function read.main.table1()
{

item = ""
itemc = ""
db.retry.point()
select ticpr300.*
from ticpr300 for update
where ticpr300.item = :item.f
or ticpr300.item = :item1.f
or ticpr300.item = :item2.f
or ticpr300.item = :item3.f
or ticpr300.item = :item4.f

order by ticpr300.item, ticpr300.indt desc
as set with 1 rows
selectdo



itemf = ticpr300.item
|db.retry.point()
select tiitm001.*
from tiitm001 for update
where tiitm001.item = :item.f
or tiitm001.item = :item1.f
or tiitm001.item = :item2.f
or tiitm001.item = :item3.f
or tiitm001.item = :item4.f


selectdo
|display("tiitm001.dsca")
tiitm001.kitm =tckitm.purchase
|tiitm001.copr = copr.f
|tiitm001.matc = copr.f
tiitm001.ltcp = date.f
db.update(ttiitm001,db.retry)

ticpr300.item = item.f
ticpr300.cntr = tiitm001.cntr
ticpr300.indt = tiitm001.ltcp
ticpr300.cpcp = "001"
ticpr300.nuni = 1.00
ticpr300.actf = 1.00
ticpr300.amnt = tiitm001.copr
db.update(tticpr300,db.retry)
commit.transaction()
message("THE ITEMS ARE UPDATED NOW",tiitm001.item)
endselect

|endif



item = ticpr300.item

endselect

}

mark_h
13th December 2010, 15:56
Remove on the very outer query " as set with 1 rows". You have a list of 4 or 5 items, but this will only return 1 item. Without really understanding what you are doing I would also expect the inner query would be tiitm001.item = :ticpr300.item. That way you are only updating one record in tiitm001 as you move through all the ticpr records. That is speculation on my part since I do not know what you are trying to accomplish.

smusba
14th December 2010, 07:45
I'm trying to update no of items with the same date as of 31-12-2009.

sameer.don
14th December 2010, 11:01
Dear Frends,

I want to update no of items at once . My query is below which is not working as expected.


When you say its not working as expected, which part of query is it failing. Does it fail to udpate ticpr300 or at tiitm001?


Regards