>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.
Nadya,
-Add alias parameter to TableUpdate()
-Be sure underlying table is also not buffered (if it's it needs a tableupdate too).
Cetin