I've three table.
1. Vehicle
2 Header Assistance Vehicle
3 Rows Assistance Vehicle
When a vehicle go in assistance there is one record in the header assistance and one or more record in rows assistance.
In the Rows Assistance Vehicle there is a field Amount. In the Header Assistance Vehicle there is a flowfield Total (sum of all amount fields in row assistance vehicle when No. field in the header is same in rows assistance vehicle field "Document No."
Now I've built a form Vehicle Card.
In this form (Card Type form)I've a subform that shows all record of Header Assistance Vehicle related to Vehicle selected.
I want to show total amount(sum of all Total field in Header Assistance Vehicle) in the form but this is a flowfield so I cannot use sumindex.
In the subform I have created a function:
LocRec.COPYFILTERS(Rec);
WITH LocRec DO BEGIN
IF Rec.FIND('-') THEN REPEAT
CALCFIELDS("Totale Manutenzione");
Total := Total + "Totale Manutenzione";
UNTIL NEXT=0;
END;
EXIT(Total);
but my problem is that when i call this function from main form it use previous record filter not actual.
So every time I move to next record in main form i see totalof previous record!!
How I can solve this problem?
0
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
There is a textbox. Its SourceExpr is CurrForm.SubformManutenzioni.FORM.TotaleManutenzioni
WITH LocRec DO BEGINIF Rec.FIND('-') THEN REPEAT
CALCFIELDS("Totale Manutenzione");
Total := Total + "Totale Manutenzione";
UNTIL NEXT=0;
END;
EXIT(Total);
this means that "totale manutenzione" refers to locrec, but i think you want to calculate it on rec, instead.
moreover, you're doing the NEXT instruction on locrec, but again, i think you want to do it on rec, instead.
edit: or most probably, you want to do it viceversa: in this way, simply remove "Rec." before the Find('-')
ps: why did you use WITH for just a few lines? it's misleading...
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
In the function, use the info from that parameter to get your data.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
http://ssdynamics.co.in