Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetNextModified and GetFldState don't agree
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01222033
Message ID:
01222335
Vues:
23
Well, as I mentioned I don't end up using a lot of defaulted values. I guess my clients just end up not needing that much, whereas it might be quite common for some others. But in this case it has nothing to do with defaulted values . . .

>But, if you use views, you CAN check if a field WAS defaulted.
>
>
>***************************************************************************
>*!*	Method:			IsRecChanged
>*!*	Purpose:		Determine if changes are pending for a record
>*!*	Author:			bxk 10.15.01
>*!*	Parameters:		tcAlias
>*!*	Returns:
>*!*	Modifications:	08.20.03 bxk Exit from loop if change detected
>***************************************************************************
>LPARAMETERS tcAlias
>
>LOCAL i, lnFields, laFields[1], lcFldState, lcChr, lcAlias, llRetval, ;
>	lcSaveAlias, lcName
>
>STORE 0 TO i, lnFields
>STORE SPACE(0) TO laFields[1], lcFldState, lcChr, lcAlias, lcSaveAlias, ;
>	lcName
>STORE .F. TO llRetVal
>
>ASSERT !EMPTY(lcAlias) ;
>	MESSAGE 'IsRecChanged() requires the alias of an open table be passed'
>
>lnBuffMode = CURSORGETPROP('buffering', lcAlias)
>IF lnBuffMode < 2
>	*!* Bail if buffering not enabled
>	RETURN .F.
>ENDIF
>
>lcSaveAlias = ALIAS()
>SELECT (lcAlias)
>
>lcFldState = GETFLDSTATE(-1, lcAlias)
>
>lnFields = AFIELDS(laFields, lcAlias)
>FOR i = 1 TO lnFields
>
>	*!* If field hasn't been defaulted
>	IF EMPTY(laFields[i, 9])
>
>		*!* If the field has been changed
>		*!* remember, the first chr in lcFldState is the delete flag
>		lcChr = SUBSTR(lcFldState, i + 1, 1)
>		IF lcChr $ '2,4'
>
>			*!* get field name
>			lcName = laFields[i, 1]
>
>			*!* See if user changed, then reverted field
>			*!* Check for .NULL., appended records return .NULL. for oldval
>			llRetVal = NVL(EVAL(lcName) != OLDVAL(lcName, lcAlias), .T.)
>			
>			*!* Found a change, we can exit
>			IF llRetVal
>				EXIT
>				
>			ENDIF	
>			
>		ENDIF
>
>	ENDIF
>
>ENDFOR
>
>IF !EMPTY(lcSaveAlias)
>	SELECT (lcSaveAlias)
>	
>ELSE
>	SELECT 0
>ENDIF
>
>RETURN llRetVal
>
>
>Our defaulted fileds are not user editable, so we don't check to see if they were changed
>
>Bruce
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform