The script below is causing very slow performance when run in SO Entry on the Lines tab. It does eventually finish, but takes a good while and is not usable in its current form. Does anyone have suggestions as to how to speed it along? The script looks up this customer in the Price Code file to determine if any special pricing exists for the customer (for any item). 'Search for any items with special pricing for this customer retval = oBusObj.GetValue("ItemCode$", ItemNo) retVal = oHeaderObj.GetValue("ARDivisionNo$", Div) retVal = oHeaderObj.GetValue("CustomerNo$", Cust) oPriceCode = oSession.GetObject("IM_PriceCode_bus") Set oPriceCode = oSession.AsObject(oPriceCode) retvalBrowse = oPriceCode.SetBrowseIndex("KCUSTOMER","") retvalBrowse = oPriceCode.SetBrowseFilter(PriceDiv&PriceCust) If not(cBool(oPriceCode.Eof)) and retvalBrowse 0 Then oPriceCode.MoveFirst() Do While not(cBool(oPriceCode.Eof)) and Found 1 retVal = oPriceCode.GetValue("PriceCodeRecord$",RecType) '2=customer item pricing retval = oPriceCode.GetValue("ItemCode$",PriceItem) retVal = oPriceCode.GetValue("ARDivisionNo$", PriceDiv) retVal = oPriceCode.GetValue("CustomerNo$", PriceCust) 'Warn user if pricing was found for other items for this customer, but not for this item. if RecType = "2" and Div = PriceDiv and Cust = PriceCust then retval = oSession.AsObject(oSession.UI).Messagebox("Contract pricig is configured for this customer.") Found = 1 else oPriceCode.MoveNext() End If Loop End If
↧