Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tableupdate reports .t. but doesn't update all records
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Tableupdate reports .t. but doesn't update all records
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01033910
Message ID:
01033910
Views:
64
Hi everybody,

I have buffering 5 for the view. I'm trying to use force update.

Here is my code in pre save hook:
WITH THIS
	IF .IsNew()

		lcTrans_Relateds_pk = cTrans_Relateds_pk
		.cAction_code = 'AD'
		REPLACE cRelateds_fk WITH IIF(cTrans_Relateds_pk == lcTrans_Relateds_pk, v_Relateds.cRelateds_pk, cRelateds_fk) ;
			cTrans_fk WITH THISFORM.cTrans_pk, ;
			iGuarantor_flag WITH 1, ;
			iPrimary_flag WITH IIF(cTrans_Relateds_pk == lcTrans_Relateds_pk,1,0) ALL
		
	ELSE
		.cAction_code = 'CH'
	ENDIF

	.lSaveTransEvents = .T.
	.cDetail_Info = ""
	.cFunction_Code = "GU"
	.cTrans_fk = THISFORM.cTrans_pk
ENDWITH
However, after I clicked on save button, only the last new record is get updated. The other records remain the same and the iPrimary_flag is still 1 for them. I'm using TABLEUPDATE(.t.,.t.) If I'm doing it slowly using the debugger, it usually updates correctly.

What could be wrong here? Why I can not change all the records?

In fact, I only want to make the new record to be primary and the previous record with flag = 1 to be 0.

What could be wrong here?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform