Re: [MSEide-MSEgui-talk] OnInternalCalcFields/OnInternalCalc and onAfterScroll problem

2011-09-21 Thread Martin Schreiber
On Wednesday 21 September 2011 05.29:49 wahono sri wrote:
 procedure dataset1_onafterscroll(DataSet: TDataSet);
 begin
  dataset2.active:= false;
  dataset2.params.parambyname('pid').value:=
 dataset.fieldbyname('id').value; dataset2.active:= true;
 end;
 
Hint: tmsesqlquery.refresh() is faster because it uses already prepared 
statement.

 procedure dataset1_oninternalcalcfields(const sender: tmsebufdataset;
const fetching: Boolean);
 begin
  sender.fieldbyname('unitdef').value:=
 dataset2.fieldbyname('defunit').value; end;
 
 My purpose is after scrolling dataset and dataset2 refreshed, I will
 change field 'unitdef' (fk_IntercalCalc) with new value from field
 'defunit' from dataset2.
 But the problem is dataset2.fieldbyname('defunit').value always get
 same value. I think oninternalcalcfields did not call after
 onafterscroll.
 As designed? or this is bug?
 
I probably don't fully understand your purpose.

fkInternalcalc fields are stored in dataset record buffer. The purpose of 
fkInternalCalc fields is to store field values which are not fetched from 
database. Because of that oninternalcalcfields is only called in 
checkbrowsemode() if the record has been edited.
fkCalculated fields are not stored in record buffer but stored in the edit 
buffer only.
fkInternalCalc fields are writable by direct data access so one can use 

 tmsebufdataset.currentas*[thefield,-1]:= thevalue;

to set the field value of the current record without beeing in edit mode. Ex.:

 dataset1.currentasinteger[dataset1.fieldbyname('unitdef'),-1]:=
  dataset2.fieldbyname('defunit').asinteger;

Hint: better use field components instead of fieldbyname().

Martin
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] OnInternalCalcFields/OnInternalCalc and onAfterScroll problem

2011-09-21 Thread wahono sri
 I probably don't fully understand your purpose.

 fkInternalcalc fields are stored in dataset record buffer. The purpose of
 fkInternalCalc fields is to store field values which are not fetched from
 database. Because of that oninternalcalcfields is only called in
 checkbrowsemode() if the record has been edited.
 fkCalculated fields are not stored in record buffer but stored in the edit
 buffer only.
 fkInternalCalc fields are writable by direct data access so one can use
 
  tmsebufdataset.currentas*[thefield,-1]:= thevalue;
 
 to set the field value of the current record without beeing in edit mode. Ex.:
 
  dataset1.currentasinteger[dataset1.fieldbyname('unitdef'),-1]:=
                  dataset2.fieldbyname('defunit').asinteger;
 
My purpose is like create master-detail recordset. After master is
scrolled, I want to put calculated value from detail to master field
(with fkinternalcalc option). But my problem, if detail has 10
records, the value from detail recordset is only from first row, as my
code above.

 Hint: better use field components instead of fieldbyname().

I know that but I should replace all my code with replace all to change them.

Thanks
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] OnInternalCalcFields/OnInternalCalc and onAfterScroll problem

2011-09-21 Thread wahono sri
 I think by a simple scroll without post the fkInternalCalc field value needs
 not to be refreshed because the data does not change? If the data in master
 dataset has been edited oninternalcalcfields of the master dataset will be
 called by updaterecord().

 If the detail dataset has constant data or can be updated locally and is small
 enough to be stored locally it is also possible to use a fkLookup field in the
 master dataset with a local index for the key field in the detail dataset.
 Please do not set TField.LookupCache. MSEgui lookup fields use the fast
 direct data access.

Maybe I do wrong to undertand oninternalcalcfields event, AFAIK this
event do after a dataset is opened or while fetching all rows, and not
called every record position is moved.
So, my problem is fixed with call another dataset (detail dataset) on
event oninternalcalcfields.

Thanks for all your suggestion.
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk


[MSEide-MSEgui-talk] Side effects from dso_restoreupdateonsavepointroll???

2011-09-21 Thread wahono sri
I don't know, is this side effect of dso_restoreupdateonsavepointroll
which I request at last week.
At the moment, in some dataset with
dso_restoreupdateonsavepointroll=true, I can commit and rollback as I
hope.
But in others dataset with dso_restoreupdateonsavepointroll=false, and
this dataset use dso_autocommitret, I can save/edit record but after I
call refresh transaction, the records is rollback (not commit).

I need your suggestion.

Thanks
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Side effects from dso_restoreupdateonsavepointroll???

2011-09-21 Thread Martin Schreiber
On Thursday 22 September 2011 06.37:22 wahono sri wrote:
 I don't know, is this side effect of dso_restoreupdateonsavepointroll
 which I request at last week.
 At the moment, in some dataset with
 dso_restoreupdateonsavepointroll=true, I can commit and rollback as I
 hope.
 But in others dataset with dso_restoreupdateonsavepointroll=false, and
 this dataset use dso_autocommitret, I can save/edit record but after I
 call refresh transaction, the records is rollback (not commit).
 
That means dso_autocommitret does not work anymore after a savepoint rollback? 
Does it work if there never was a call to 
tsqltransaction.savepointrollback() ?

Martin
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk


Re: [MSEide-MSEgui-talk] Side effects from dso_restoreupdateonsavepointroll???

2011-09-21 Thread wahono sri
 That means dso_autocommitret does not work anymore after a savepoint rollback?
 Does it work if there never was a call to
 tsqltransaction.savepointrollback() ?
dso_autocommitret does not work before and after call savepointrollback.
___
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk