Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Frustration with private dataset not saving
Message
From
19/10/2010 12:39:54
 
 
To
18/10/2010 16:33:48
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Miscellaneous
Thread ID:
01486018
Message ID:
01486150
Views:
194
My understanding was always that the IN clause was added so that you could perform a replace on a table that wasn't the currently selected table. I have always used it for this purpose, and I always use it in every replace statement. It seems like a good defensive programming technique, and it makes the code self-documenting, and it reduces lines of code, and it eliminates or reduces the possibility of side effects where some other routine changes the currently selected table. No?



>If you're using REPLACE instead of UPDATE - SQL, IMO the IN ... clause is mandatory for unexpected/Heisenbug resistance.
>
>IIRC the behaviour Dragan points out goes back to dBASE III, if not earlier. Since it's possible to purposely design software where the REPLACE doesn't happen if EOF( [currently selected alias] ) is .T., it's officially a "feature", not a bug, and Fox Software perpetuated the behaviour in FoxBASE/FoxPro.
>
>The introduction of the IN ... clause basically lets users who consider this behaviour a bug, to turn it off.
>
>>Interesting - I have never needed that clause in the past (that I know of), but will definitely try it!
>>>>
>>>>PARAMETERS l_check
>>>>
>>>>* l_check values
>>>>* 1 = yes
>>>>* 2 = no
>>>>SET STEP ON
>>>>
>>>>thisform.pageframe1.page1.tol_no.Value = 0
>>>>thisform.pageframe1.page1.tol_yes.Value = 0
>>>>
>>>>
>>>>IF thisform.isloading AND thisform.isediting then
>>>>	l_check = VAL(jcpmt.tolerance)
>>>>ELSE
>>>>	replace jcpmt.tolerance WITH ALLTRIM(STR(l_check))
>>>>ENDIF
>>>>	
>>>>IF l_check = 1		&&yes
>>>>	thisform.pageframe1.page1.tol_yes.Value = 1
>>>>ELSE
>>>>	thisform.pageframe1.page1.tol_no.Value = 1
>>>>ENDIF
>>>>
>>>>thisform.pageframe1.page1.tol_yes.Refresh
>>>>thisform.pageframe1.page1.tol_no.Refresh
>>>>
>>>>
>>>>the replace command sometimes just doesn't update the table....what am I missing here?
>>>>
>>>>thanks in advance!
>>>
>>>Let's try with usual suspects first. In case you're sitting on an alias which is at eof(), the replace won't take place... unless
>>>
>>>
replace jcpmt.tolerance WITH ...whatever... in jcpmt
>>>
>>>which circumvents that.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform