beas form events
Hi,
I'm trying to run some code automatically as soon as the form is displayed and finished loading (reservation / issue form). In the help file it says form_loaded and form_opened are executed before the form is complete and populated and that won't work for me (but the code does execute). The help file also mentions form_show (end of opening window process) - but when I put code in that event it doesn't execute at all. Is that event active? Should it work and I've made a mistake?
Thanks,
Phil
-
Apologies - beas script (obviously)........
-
Hi Phil,
the reservation system is a little special form. What do you want to change? Do you have an example?
regards
Martin
-
Hi Martin,
The customer wants to simplify the life of the operator in a cutting operation. I open the form with a custom filter showing lines with the same material. When the user hits the button it opens an input box to ask for the number of sheets - using the ratio in the work order bill of material it divides the number of sheets into all of the jobs displayed on the screen - issuing each line . The customer wants me to run the code automatically when the form opens instead of the user having to hit a button. The code is below.
// take number of sheets entered and distribute across orders
// check first if there is available stock.
Input=Host Quantity:=ll_sheets=0=cancel// Issue sheets to multiple jobs
//messagebox=<dw_2.item.itemcode:[1].value>setvar=ll_nooflines=0
setvar=ll_wos=// check inventory is there
sql=select "OnHand" from "OITM" where "ItemCode"='<dw_2.item.itemcode:[1].value>'
setvar=ll_result=%sub(<wert1>,<ll_sum>)
if <ll_result> <= 0 then
messagebox=Not enough sheets in stock (<wert1>).
cancel
end if// loop through and sum requirements, then loop through again and issue all components
setvar=ll_sum=0
for ll_loop=1 to <dw_2.rowcount>
setvar=ll_sum=%numadd(<ll_sum>,<dw_2.item.neededqty:[ll_loop].value>)
next
//messagebox=<ll_sum> - Total
if <ll_sum> = 0 then
question=id=check_requirements<tab>text=0 sheets are required. Are you sure you want to continue?<tab>yes=carryon<tab>no=cancel
end if[carryon]
//messagebox=<ll_sum,0.0000>
declare=res=ue_reservation
res=planned=new=issuewofor ll_loop=1 to <dw_2.rowcount>
setvar=ll_percent=%dif(<dw_2.item.neededqty:[ll_loop].value,0.0000>,<ll_sum,0.0000>)
setvar=ll_wo=<dw_2.item.docentry:[ll_loop].value>
setvar=ll_belpos=<dw_2.item.linenum:[ll_loop].value>
setvar=ll_pos=<dw_2.item.linenum2:[ll_loop].value>
setvar=ll_itemcode=<dw_2.item.itemcode:[ll_loop].value>
setvar=ll_whs=<dw_2.item.whscode:[ll_loop].value>
//messagebox=<ll_loop> - <ll_percent>
setvar=ll_qtytoiss=%mul(<ll_percent>,<ll_sheets>)
//messagebox=<ll_loop> - Percent <ll_percent,0.0000> - Qty <ll_qtytoiss>
res=planned=addline=base_doctype=wo<tab>base_docentry=<ll_wo><tab>base_linenum=<ll_belpos><tab>base_linenum2=<ll_pos><tab>itemcode=<ll_itemcode><tab>whscode=<ll_whs><tab>quantity=<ll_qtytoiss,0.0000><tab>savenext
res=issuewo
form.reload
messagebox=All host material issued.
form.show -
Martin,
This is the reservation form but being used to production issue....... if you like I'll show you what's being built for the customer if you are interested.
Phil
-
Hi Phil,
i think, this script is part of button click
what do you want to insert in the form_open event?
Please sign in to leave a comment.
Comments
5 comments