>Hi all
>
>I have this typical requirement where I have to AVG() the Top line items which equal to the First Line item of the same set. to explain...
>
>
>iID ParentID Col 10 Col 13
>1 22 39.5 5.936
>2 22 39.5 6.002
>3 22 39.5 6.027
>4 22 43.5 6.078
>5 22 39.5 6.106
>
>
>Of the above I have to avg() col 13 based on the first reading of col 10 upto the readings of col 10 which are constant, but nothing after the breakage. ie. I have to avg(5.936, 6.002, 6.027) but not to avg 6.106 though col 10 equals to the first value. This is a child of the parent-child so I also have to take care of subset to ParentID 22 only as in this case.
>
>I hope I have been able to explain this.
>
>Please advise.
if seek(parentID,'child','fktag')
select child
lnCol10 = col10
calculate avg(col13) ;
while parentID=parent.parentID and col10 = lnCol10 ;
to lnResult
endif
Cetin