Finding last by value

The following code illustrates how to use the FindLast method to find the partition policy detail that is used to store data of a specific value when the policy is defined as a range. This code checks if all orderlines falls within the defined partitions:

define variable policy as IPartitionPolicy no-undo. 
define variable detail as IPartitionPolicyDetail no-undo. 

policy = service:GetPartitionPolicy("orderlineDate")

for each order no-lock: 
    detail = policy:Details:FindLastByValue(order.orderDate).  
    if not valid-object(detail) then 
    do:
        <do some action for missing partition detail>   
    end.     
end.