USE speed replace ALL spd_char WITH myudf(spd_id) RETURN FUNCTION myudf LPARAMETERS tiID LOCAL lnSelect lnSelect = SELECT() SELECT 0 IF !used("mylog") CREATE CURSOR mylog (log_id i) ENDIF APPEND BLANK IN mylog replace log_id WITH m.tiID IN mylog SELECT (lnSelect) RETURN STR(m.tiID)You really should trace the code and see why its failing. Don't guess what's wrong, prove, know! understand! I know I sound like Yoda in Star Wars, but don't start trying a variety of solutions without knowing why you have the problem!
>******************************************************************************** >function GetPrSlInfo >* Description.......: Function returns the previous sale info if it exists >* Calling Samples...: GetPrSlInfo(PROPID,SOURCE,DATE,"Date","C",8) >* Parameter List....: tnPropid, tcSource, tdDate, tcFieldName, tcRetType (Optional), tnNumChar (Optional) >* Created by........: Nadya Nosonovsky 08/15/01 12:04:59 PM >* Modified by.......: Nadya Nosonovsky 08/15/01 12:05:02 PM >******************************************************************** >lparameter tnPropId, tcSource, tdDate, tcFieldName, tcRetType, tnNumChar, lnRecno, lnReccount >local lnSelect, lVar >lnSelect=select() >lnRecno = recno() && Assuming we're sitting on the correct file >lnReccount = reccount() >if !used('curPrevSlInfo') > select 0 > create cursor curPrevSlInfo (RecNum I, date D, Price I, Book I, page I) > append blank >endif >if curPrevSlInfo.RecNum <> m.lnRecno > replace RecNum with m.lnRecno in curPrevSlInfo >* lVar=CreateEmptyVar(m.tcFieldName,'TranMstr') > if m.tcSource = "S" and seek(str(m.tnPropId,9)+dtos(m.tdDate),"TranMstr","TrxnHist") > select TranMstr > set order to TrxnHist > if !eof() > skip > if TranMstr.PropID = m.tnPropId > do while TranMstr.PropID = m.tnPropId > if TranMstr.source = "S" and TranMstr.date < m.tdDate > replace Date with TranMstr.Date, ; > Price with TranMstr.Price, ; > Book with TranMstr.Book, ; > Page with TranMstr.Page in curPrevSlInfo >*!* scatter memvar >*!* insert into curPrevSlInfo from memvar > exit > endif > if !eof() > skip > else > exit > endif > enddo > endif > endif > endif >endif >lVar = evaluate('curPrevSlInfo.'+ m.tcFieldName) >if m.lnRecno=m.lnReccount && Last record > use in curPrevSlInfo >endif >select (m.lnSelect) >if !empty(m.tcRetType) > if vartype(m.lVar)<>m.tcRetType > return ConvertType(m.lVar,m.tcRetType,m.tnNumChar) > endif >else > return m.lVar >endif>