Subject | Re: [IBO] Totalising columns & 'Record not located to update' error |
---|---|
Author | Helen Borrie |
Post date | 2001-06-03T01:35:06Z |
At 01:32 AM 03-06-01 +0000, you wrote:
Also note that the OnCalculateField event won't take place until the dataset is being refreshed. I'm pretty sure you can call CalculateFields manually at other times, though.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>What is the best way to totalise a column in a grid?The reason for this error is that, at this point, you have not committed the inserts to the database - therefore, there is nothing there to update.
>
>JobsQry is Master to ItemsUsedQry, & "LINE_TOTAL" is a calculated
>field. IB3.6Dg
>
>My approach below causes a 'Record not located to update' error when
>the ItemsUsedQry gets posted, presumably because I've hit the Eof
>within this handler. The SQLMonitor shows it's trying to post most
>Detail fields with nulls, after the Master has posted OK.
>void __fastcall TJobsForm::ItemsUsedSrcDataChange(TIB_StatementLinkHERE. You are testing for dssEdit state when the new rows are still in dssInsert so nothing happens.
>*Sender, TIB_Statement *Statement, TIB_Column *Field)
>{
> Currency total = 0;
> if (Field &&
> (Field->FieldName == "QTY" || Field->FieldName == "UNIT_PRICE") &&
> Field->IsModified &&
> ItemsUsedQry->State == dssEdit)
> {
Also note that the OnCalculateField event won't take place until the dataset is being refreshed. I'm pretty sure you can call CalculateFields manually at other times, though.
Regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________