Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Default values and GetFldState function
Message
De
04/07/2006 04:17:15
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01133463
Message ID:
01133537
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>I'm using a view. The table has iActive_Flag field with default value = 1. In my view I set the same default value for the iActive_Flag. Now, when I add a record, GetFldState function reports this field as changed and therefore even if I don't change anything I see a question asked: "Do you want to save your changes?".
>
>How can I solve this problem?
>
>Thanks in advance.

vfp implement DEFAULT with a two step job:
1. fill the record fields with 0 or NULL
2. loop on fields list and update every FIELD with a DEFAULT clause,
this step set the FLDSTATE.

This is a vfp bug.
clear
CREATE CURSOR aa (f1 i null,f2 i DEFAULT -1)
CURSORSETPROP("Buffering",5)

SET NULL ON

APPEND BLANK
? GETFLDSTATE(-1),f1 at 20,f2

INSERT INTO aa FROM memvar
? GETFLDSTATE(-1),f1 at 20,f2

SET NULL OFF
INSERT INTO aa FROM memvar
? GETFLDSTATE(-1),f1 at 20,f2

USE

CREATE CURSOR aa (f1 i null,f2 i DEFAULT -1)
CURSORSETPROP("Buffering",5)

INSERT INTO aa FROM memvar
? GETFLDSTATE(-1),f1 at 20,f2

#IF VERSION(2)>900
	* I wish this on VFP10
	SETFLDSTATE(-1,REPLICATE('3',FCOUNT()))
#ELSE
	FOR f=1 TO FCOUNT()
		=SETFLDSTATE(m.f,3)
	NEXT
#ENDIF

? GETFLDSTATE(-1),f1 at 20,f2

USE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform