claimline claimid benededuct maxoutaccrual Lifetimeaccrual date
1 81813 100 25 225 24-08-08
2 81813 0 25 325 27-08-08
3 81813R1 -100 -25 -325 02-09-08
Here records with claimid where R1 is present are reveresal claims
i need to determine the last claim line by finding the most-recent claim date and the highest claim line number . If lifetimeaccrual is zero or negative, need to work back to the next-highest claim line number. If all lines on the claim have zero or negative lifetimeaccrual amounts, again work back to the next-most-recent claim date and start again with the highest-numbered claim line.
we can select max(claimline) and select Lifetime but if amt is -ve or zero what is the function where we can get back to next highest claimline and date????
Thanks in advance