Good Morning,
I have about 20 calculation UDF and 3 of the tablesum() function on a form and used it on the calculation value expression.
The form is running too slow so I added the Ui_msg_box() on one of the UDF. Whenever open or closed this form, the same message is shown several times until the end of related UDFs.
Is the way faster and avoid the repeating the scripts?
One Sample of my UDF.
Code:
FUNCTION Calc_ChngOdr_Fica AS N (vChangeOdrId as c)
'Get field value from Current ChangeOrder form
dim tChangeHd as p
dim qChangeHd as p
dim nChangeHd as n
dim vProjectId as c
dim vAdjRate as c
tChangeHd = table.open("change_hdr",FILE_RO_SHARED)
query.order="hdr_id"
query.filter ="hdr_id="+quote(vChangeOdrId)
qChangeHd = tChangeHd.query_create()
nChangeHd = qChangeHd.records_get()
if nChangeHd>0 then
vProjectId = tChangeHd.project_id
vAdjRate = tChangeHd.Adjust_fica
tChangeHd.close()
'Get the Default value from Contracts table within same project
dim vBdgtRate as n
vBdgtRate = Bdgt_FicaRate(vProjectId)
dim vConvRate as c
vConvRate = convert_type(vAdjRate,"n")
dim vItemRate as n
vItemRate = if(isblank("var->vAdjRate"),vBdgtRate,vConvRate)
'How to get the Current Items value?
dim vTempSum as n 'Toal value of the Labor
vTempSum = Calc_ChngItm_SumLbr(vChangeOdrId) 'Get the Labor Value for current change order
'ui_msg_box("Materials","Total material Amount is "+vMtrSum)
'Final Calulation
Calc_ChngOdr_Fica = Round(vTempSum*vItemRate/100,2)
'ui_msg_box("Final SalexTax","Calculated Salex Tax is "+"co"+vChangeOdrId +" rate " +vItemRate+" and Result Value is "+Calc_ChngOdr_Fica)
end if
END FUNCTION
Bookmarks