Hola Bhavbhuti!
I am not sure exactly where is the error, but there is it:-)
Thincking What I do ...
1.- Table Buffering in Child BOs is correct. 2.- The Empty query Results is the problem. 3.- Empty Queries is not due to buffering. 4.- Check if Empty Query is before, in or later this method executes. 5.- I soppose you use grids to childs. And you use some code to validate or detect column or row changing or do something. Check it, it's possible a bad ubication of this code. 5.- I am not sure if SUM Select moves pointer record, but if it changes the grid could execute some code. This doesn't must executes. 6.- Use the Lockscreen property to .T. before execute code and restore to .F. at end.
Mainly My Empty query problems are due to code in the grid into refresh, lostfocus or valid methods. I don't remember.
I expect this help you.
Good look!
Try and comment results please ;-)
<i><font color="#663300">Hi All
I just shifted my code from BeforeSave() to AfterSave() and the summing returned is now giving correct results. But this is happening after the fact and I cannot stop the save from happening if the validation fails, ie. both the v_sJVDr.yAmount and v_sJVCr.yAmount totals are different.
Plus any changes I make to the values of v_sJVDr.yAmount and/or v_sJVCr.yAmount doesn't reflect in the v_tJV.yDrTotal and v_tJV.yCrTotal fields. But they refresh as soon as I save the complete transactions.
Grid Pros, Please help me with this buffering issue.
<i><font color="#663300">Hi all
I have used the SbS by Ed as my base for this form. Thus I have a Parent BO/view with 2 child BO/views. Both the child BO's have in their data-environment Optimistic Table buffering. At the time of saving in the parent BOs BeforeSave() I have the following code: <code> DODEFAULT()
LOCAL lnSelect, liID, llNotMatching
lnSelect = SELECT() liID = v_tJV.iID llMatching = .T.
SELECT SUM(yAmount) AS yAmount ; FROM v_sJVDr ; WHERE iPID = liID ; GROUP BY iPID ; INTO CURSOR Debit BROW NORM
SELECT SUM(yAmount) AS yAmount ; FROM v_sJVCr ; WHERE iPID = liID ; GROUP BY iPID ; INTO CURSOR Credit BROW NORM
IF Debit.yAmount # Credit.yAmount = MESSAGEBOX("WARNING !!!" + CHR(13) + "The Debit total does NOT EQUAL the Credit Total")
llMatching = .F. ENDIF
USE IN Debit USE IN Credit
SELECT (lnSelect)
RETURN llMatching </code> 1) I cannot save, as the child BOs will alway return empty query results due to buffering. 2) If I comment the code llMatching = .F. and then I save the records using matching amount and uncomment the same code. 3) Now I edit the same record for non-matching amounts, the warning will not trigger becuase in the buffer the Debit and Credit totals have same values (step 2) 4) Now I again edit and save matching amounts, the warning will nevertheless trigger becuase in the buffer the Debit and Credit totals do not have same values (step 3)
I have tried using Record Buffering for Child BOs, then as soon as I move off the child record it is saved. I cannot use revert to get back to previous values in the child BOs. This makes the above code useless as the parent BOs BeforeSave() is never triggered when a child record is edited.
I have also tried shifting the code from BeforeSave() of the Parent BO to the forms BeforeSave(), ditto.
What options do I have?</font></i>
</font></i>
From Gavilan programa1 /AT/ hotmail .D.OT com
Thanks to CodeBook ... and You Too. ©2002 Enrique Gavilan |