Board index » off-topic » ClientDataSet InternalCalc not fired for all records
|
Erick Sasse
Delphi Developer |
|
Erick Sasse
Delphi Developer |
ClientDataSet InternalCalc not fired for all records2006-05-22 10:30:58 PM off-topic18 I have added a InternalCalc Field to a ClientDataSet and I'm calculating it on the OnCalcFields like this: if DataSet.State = dsInternalCalc then begin cdsLancVALORFINAL.AsCurrency := cdsLancVALOR.AsCurrency + cdsLancACRESCIMO.AsCurrency; end; My problem is that the event is not getting fired with the State = dsInternalCalc for all records. So some of the records are not calculated. The records that is not calculated because the State is dsCalcFields, and not dsInternalCalc. I'm not able to find the problem. Any ideas? Thanks! -- Erick Sasse |
| Bill Todd
Delphi Developer |
2006-05-23 01:44:42 AM
Re:ClientDataSet InternalCalc not fired for all records
I am not sure that I understand the problem. Since the value of an
internal calculated field is stored as part of each row it only needs to be calculated when one of the values used in the calculation changes for a particular row. An internal calculated field is not supposed to recalculate each time a row is accessed. -- Bill Todd (TeamB) |
| Erick Sasse
Delphi Developer |
2006-05-23 02:26:40 AM
Re:ClientDataSet InternalCalc not fired for all records
Bill Todd wrote:
QuoteI am not sure that I understand the problem. Since the value of an is equal to dsInternalCalc? -- Erick Sasse {smallsort} |
| Bill Todd
Delphi Developer |
2006-05-23 02:39:51 AM
Re:ClientDataSet InternalCalc not fired for all records
Erick Sasse wrote:
QuoteOk, so where is the right place to calculate the internal calculated -- Bill Todd (TeamB) |
| Erick Sasse
Delphi Developer |
2006-05-23 03:08:05 AM
Re:ClientDataSet InternalCalc not fired for all records
Bill Todd wrote:
QuotePerhaps it would help if you explain what is not working right for the DataSet.State is dsCalcFields and not dsInternalCalc, so a lot of records are not calculated. I mean for most of records, the OnCalcFields is never fired with DataSet.State equal to dsInternalCalc. I hope I was more clear now. Thanks for your time. -- Erick Sasse |
| Bill Todd
Delphi Developer |
2006-05-23 03:31:56 AM
Re:ClientDataSet InternalCalc not fired for all records
So some records have the correct value in the internal calculated field
and the other records have null for the value of the internal calculated field. Is that correct? -- Bill Todd (TeamB) |
| Erick Sasse
Delphi Developer |
2006-05-23 03:35:27 AM
Re:ClientDataSet InternalCalc not fired for all records
Bill Todd wrote:
QuoteSo some records have the correct value in the internal calculated Erick Sasse |
| Bill Todd
Delphi Developer |
2006-05-23 05:19:32 AM
Re:ClientDataSet InternalCalc not fired for all records
Erick Sasse wrote:
QuoteBill Todd wrote: The only workaround that I can suggest is to recalculate the field whenever the OnCalcFields event fires. -- Bill Todd (TeamB) |
| Erick Sasse
Delphi Developer |
2006-05-23 05:34:09 AM
Re:ClientDataSet InternalCalc not fired for all records
Bill Todd wrote:
QuoteSince this is happening with D2006 you should file a bug report in QC QuoteThe only workaround that I can suggest is to recalculate the field Erick Sasse |
| vavan
Delphi Developer |
2006-05-23 01:46:20 PM
Re:ClientDataSet InternalCalc not fired for all records
On 22 May 2006 14:34:09 -0700, "Erick Sasse"
< XXXX@XXXXX.COM >wrote: Quote>Since this is happening with D2006 you should file a bug report in QC field using bds2006 (in bcb5 I used all these years before everything was just fine) for me State is _never_ dsInternalCalc within OnCalcFields event handler. it looks like there's regression bug within latest midas.dll so CalcFieldsCallBack never gets called (?) Quote>The only workaround that I can suggest is to recalculate the field insert state' another bug I encountered in bds related to wrong handling of some Constraints in CDS so I had to remove them and write code within BeforePost handler -- Vladimir Ulchenko aka vavan |
| Erick Sasse
Delphi Developer |
2006-05-23 07:27:02 PM
Re:ClientDataSet InternalCalc not fired for all records
vavan wrote:
Quotecool! that's exactly the problem I encountered just yesterday. Erick Sasse |
