Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding REPLACE command - why I don't get the erro
Message
 
 
À
08/03/2002 19:38:09
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00630443
Message ID:
00630642
Vues:
27
Hi Mike,

What if you include replacement of numerical field with bigger number? My problem is, what I didn't get a Numerical overflow error, as I should get. Did you get this error correctly, when you ran your test program?

Thanks in advance.

>Nadya,
>
>I always include the IN Y clause. I don't specify the alias (Y.) on each field. I only specify the alias on fields outside of the target like X in this case.
>
>replace TotRooms with 10000, BedRooms with 1000, ;
>PRSLDATE WITH GetPrSlInfo(X.PROPID, X.SOURCE, X.DATE,'Date') IN Y
>
>Now as to the function...
>
>If the following seek lands your record pointer on the last record in TranMstr, the skip will leave you on EOF() in 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
>
>
>I gave up on your code after that point.
>
>I did this little program and it ran correctly for 118,000 records before I stopped it. I even stopped it and reran it, so that mylog already existed and wasn't recreated. It appears you can CREATE CURSOR in a UDF called during a replace command.
>
>
>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!
>
>Now, you still have to go and figure out what's wrong with the code.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform