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