Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This.Parent
Message
 
 
À
25/07/2000 11:22:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00396574
Message ID:
00396658
Vues:
9
Hi Milt,

Do you use some sort of buffering or you write directly in a table? I didn't see in your code any references to textboxes, so you manipulate directly with field contents. Am I right? The code you show is quite combersome. If I were you, I would create bunch on variables:
lnAmount, lcc_region, etc. and operate them instead of evaluate. This would make the code more readable. It also gives you more control and it would be easy to debug.

Also, I would try
select Mailcode
set order to correcttag
seek lcField
if found()
etc.
Just to check, what's going on...

>Here the code for the mbeforesave:
>*-- mbeforesave
>llretval = .T.
>
>*-- Standard validation for subscriber table is in a stored procedure
>DO CASE
>	CASE EVALUATE(This.psavetable+".n_amount") = 0
>		cmessage = "Please enter rate amount."
>		=MESSAGEBOX(cmessage,MB_ICONEXCLAMATION + MB_OK,;
>		APP_LOC)
>		llretval = .F.
>		RETURN llretval
>ENDCASE
>		
>IF !EMPTY(EVALUATE(This.psavetable+".c_region"))
>	IF !SEEK(EVALUATE(This.psavetable+".c_region"),"Region")
>		cmessage = "The region code you entered is not correct."
>		=MESSAGEBOX(cmessage,MB_ICONEXCLAMATION + MB_OK,;
>			APP_LOC)
>		llretval = .F.
>		RETURN llretval
>	ENDIF
>ELSE
>		cmessage = "Please enter region."
>		=MESSAGEBOX(cmessage,MB_ICONEXCLAMATION + MB_OK,;
>				APP_LOC)
>			llretval = .F.
>			RETURN llretval
>	ENDIF
>
>	IF !EMPTY(EVALUATE(This.psavetable+".c_mailcode"))
>		SELECT mailcode
>		IF TAG() <> "c_mailcode"
>			SET ORDER TO TAG c_mailcode
>		ENDIF
>		SET FILTER TO
>		SET FILTER TO mailcode.c_region_id = EVALUATE(This.psavetable+".c_region")
>		IF !SEEK(ALLTRIM(UPPER(EVALUATE(This.psavetable+".c_mailcode"))),"Mailcode")
>			=MESSAGEBOX(NOTVALIDMAILCODE,MB_ICONEXCLAMATION + MB_OK,;
>				APP_LOC)
>			llretval = .F.
>			RETURN llretval
>	ENDIF
>		
>	*-- We were successful in our seek so now look in rates
>	*-- table to see if amount enter is correct
>	SELECT Rates
>	SET ORDER TO TAG c_rateid
>	IF SEEK(Alltrim(mailcode.c_rates),"Rates")
>		SELECT rates
>		SET FILTER TO
>		SET FILTER TO ALLTRIM(rates.c_rates) + ALLTRIM(rates.c_region_id) =  ALLTRIM(mailcode.c_rates) + EVALUATE(This.psavetable+".c_region")
>		SCAN
>			IF Rates.n_cost = EVALUATE(This.psavetable+".n_amount")
>				*-- Amount enter is a valid rate for mailcode
>				lnotvalidrate = .F.
>				EXIT
>			ELSE
>				lnotvalidrate = .T.
>			ENDIF
>		ENDSCAN
>		IF lnotvalidrate
>			=MESSAGEBOX(NOTVALIDAMT,MB_ICONEXCLAMATION + MB_OK,;
>				APP_LOC)
>			llretval = .F.
>			RETURN llretval
>		ENDIF
>	ENDIF
>RETURN llretval
>ENDIF
>
>
>And here the code for the save button
>
>SELECT (This.Parent.psavetable)
>	llretval = Thisform.mdetectchanges()
>	IF llretval
>		llretval = This.Parent.mbeforesave()
>		IF llretval
>			IF This.Parent.Parent.Parent.Page5.grdentrydata.ppreviousamt <> EVALUATE(This.Parent.psavetable+".n_amount")
>				REPLACE v_batchinfo.n_amt_entered WITH v_batchinfo.n_amt_entered + EVALUATE(This.Parent.psavetable+".n_amount")-;
>					This.Parent.Parent.Parent.Page5.grdentrydata.ppreviousamt
>				REPLACE (This.Parent.psavetable+".n_last_order") WITH EVALUATE(This.Parent.psavetable + ".n_amount")
>				REPLACE (This.Parent.psavetable+".n_org_order") WITH EVALUATE(This.Parent.psavetable + ".n_amount")
>			ENDIF
>				lcFieldValue = Evaluate(This.Parent.psavetable+".c_mailcode")
>				lcFieldValue = ALLTRIM(UPPER(lcFieldValue))
>				WAIT WINDOW lcFieldValue
>				IF SEEK(lcFieldValue,"Mailcode")
>				SELECT rates
>				SET FILTER TO ALLTRIM(c_rates) + ALLTRIM(rates.c_region_id) = ALLTRIM(Mailcode.c_rates) + ALLTRIM(EVALUATE(This.Parent.psavetable + ".c_region"))
>				LOCATE
>				SCAN
>					IF Rates.n_cost = EVALUATE(This.Parent.psavetable + ".n_amount")
>						REPLACE (This.Parent.psavetable + ".i_itg") WITH rates.i_nocheck
>						REPLACE (This.Parent.psavetable + ".i_itgbargains") WITH rates.i_nobargain
>						REPLACE (This.Parent.psavetable + ".c_premiumproduct_id") WITH rates.c_premiumproducts
>						REPLACE (This.Parent.psavetable + ".i_itgpremium") WITH rates.c_nopremiumproducts
>					ENDIF
>				ENDSCAN
>			ENDIF
>		ELSE
>			RETURN
>		ENDIF
>	ENDIF
>ENDIF
>
>The wait window show the value but it still bombs on If Seek
>
>Thanks
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform