0
votes

I have two tables (MetreR)and (Billing):

MReading date amount Billgen

Billing
  date
  amout
  Customer No

I want to insert a record from MetreR table to Billing, anytime data or a record hits the MetreR table. It must run always. I don't want to use a job queue.

MetreR.RESET;
MetreR.SETFILTER(MetreR.Billgen,'%1',FALSE);
IF MetreR.FIND('-') THEN BEGIN
REPEAT


    Billing.INIT;
    Billing.ID:=MetreR."No.";
    Billing."Customer No.":=Customers."No.";
    Billing.Amount:=Billing.Consumption;

      MetreR.Billgen:=TRUE;

MetreR.MODIFY;
END;

UNTIL MetreR.NEXT=0; END;

2

2 Answers

1
votes

Are you able to extend or modify the MetreR table? if so then you should add your code to OnInsert on that table.

0
votes

Yeah, you can use OnInsert trigger on MeterR table. So that whenever there is any insert to that table, you can update Billing table through OnInsert trigger.