mnmhema
6th November 2012, 10:25
I need to update PlannerID for a range of Items for a specific supply source.
I have made two input fields for Items From and Items To in a form
I have also created a drop down list to select the Default Supply Source.
I don't know how to use these values in the program script code, which update table.
If anyone can provide me with a sample code, it will be very helpful.
mark_h
6th November 2012, 16:38
The concept is the same, but you would just use in range for items and the planner code. The below function gets passed the item number.
function get_data()
{
db.retry.point()
old.csig = ""
new.csig = ""
rpt.comment = ""
select tiitm001.*
from tiitm001 for update
where tiitm001.item = :find.item2
selectdo
if tiitm001.csig = csig.from then
old.csig = tiitm001.csig
new.csig = csig.to
if update.std.item = tcyesno.yes then
tiitm001.csig = new.csig
db.update(ttiitm001, db.retry, elocked)
commit.transaction()
endif
else
rpt.comment = "Signal code does not match input code"
endif
rprt_send()
selectempty
tiitm001.item = find.item
rpt.comment = "Item not Found"
rprt_send()
endselect
}
So yours would be like below. You can tweak for you variables and needs.
function get_data()
{
db.retry.point()
select tiitm001.*
from tiitm001 for update
where tiitm001.item inrange :item.f and :item.2
and ..whatever else you need
selectdo
tiitm001.cplb = new.planner.code
db.update(ttiitm001, db.retry, elocked)
commit.transaction()
endselect
}