I have a variable which have to show all values from field of table (this is NOT a Source table, so SourceTempTable property on my page is set to 'YES'). But my variable show only latest value from the field of table in all records that it represents.
I have this code on my page in OnAfterGetRecord() trigger
currReq:= Rec."Request No.";
po_l.SETCURRENTKEY(po_l."Purchase Request No.",po_l."Document Type");
po_l.SETRANGE(po_l."Purchase Request No.",currReq);
po_l.SETRANGE(po_l."Document Type",po_l."Document Type"::Order);
IF po_l.FINDSET THEN BEGIN
repeat
begin
AmountToBeInvoiced:= po_l."Amount to be Invoiced";
END;
UNTIL po_l.NEXT = 0;
END;
And my result is next:
Any ideas??
p.s: po_l - record variable of a table (not Source table)
Answers
Hi
this line of code will work next way: the first record "Amount to be Invoiced"=10 will be find and set in AmountToBeInvoiced as first value; and the second value will be 20=10+10, third 30=20+10, etc.
But I have to get all values from field of table "po_l" and write them to the variable "AmountToBeInvoiced"
Hi,
I do not have to make calculations. I just want to copy values from field of po_l table to the variable on my page
If there are two line in PO_l table than you want to display "10, 20" in this field, right?
10 is amount from the first record and 20 from the second.
Hi,
No, post with values 10 and 20 was just explanation for AK why his line of code will show incorrect result.
Ok, lets imagine that I have next values of table (for example it have "Order Line" name) field:
1
2
3
4
10
And I have a page (for ex. it have "My table list" name) with fields from source table (for ex. source table name is "My table" name). On this page I have a field named "AmountToBeInvoiced", so I want to fill this field with values from "Order Line" table:
1
2
3
4
10
Above way to do this by code was represented. But I have no idea why my code does not work and "AmountToBeInvoiced" field is filled by the same value