If the DDO had to scan the entire database for every find, users could be waiting a very long time to find a record or set of records. The DDO will try to optimize the search by using the index you have programmed to find by and "jumping into" the index. Whenever a find is executed, the constraints are evaluated with the index in use to see if any optimization can be done. This is automatic—you don’t have to program anything further to make this happen.
However, if the current index can’t help the search, the DDO could have to scan the entire table. If the table has a large number of records, this may be slow. You should always test that constrained find are properly optimized for the indexes you are using (or you should at least know if the finds are not optimal). Techniques for testing this are discussed in Debugging DDOs.
Set Ordering to 3
When using constraints and filters, often only one index will provide you with proper optimized finding. When this is the case, you want to make sure you are using that best index.
You can force the DDO to always use a particular index to ensure that it finds quickly. You do this by setting the DDO’s ordering property to that index number. Normally, the value of this property is –1, which allows it to use whatever index is requested by the find message.
Object oOrderHea_DD is an OrderHea_DataDictionary
End_Object
Object oOrderDtl_DD is an OrderDtl_DataDictionary
Set DDO_Server to oOrderHea_DD
Set Constrain_File to oOrderHea.File_Number
Set Ordering to 1 // this is the only index that can be optimized
End_Object