Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default values and GetFldState function
Message
 
 
To
04/07/2006 04:17:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01133463
Message ID:
01133618
Views:
14
>>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
>
Thanks, Fabio. I agree, that it may be viewed as a bug. In my case it's not easy to play with SetFldState because it would require change in a framework class. For one form in question I applied another simple solution, but in general we may want to make this change. I'll try to raise this question at our developers meeting, but I think we're too far in our development now to allow any changes in framework classes, so I expect the negative response.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform