T
Tim Kuehn
Guest
The only valid uses for FIND FIRST is if you know there's a number of records with values that match the WHERE criteria, and you're ok with that. Say you're checking OrderLine to see if any records exists for an Order.OrderNum. In that case a structure like this FIND FIRST OrderLine WHERE OrderLine.OrderNum = Order. OrderNum NO-LOCK NO-ERROR . is appropriate. Another example is the question of whether any of the OrderLine records for an Order have been processed - FIND FIRST OrderLine WHERE OrderLine.OrderNum = Order. OrderNum AND OrderLine.isProcessed = TRUE NO-LOCK NO-ERROR . also is appropriate. What isn't appropriate is something like this - FIND FIRST OrderLine WHERE OrderLine.OrderNum = Order. OrderNum AND OrderLine.LineNum = 1 NO-LOCK NO-ERROR . because OrderLine.OrderNum, OrderLine.LineNum is supposed to be unique for that table. If for some reason the OrderLine table got a duplicate Orderline, Linenum record a FIND FIRST would cover up that fact instead of failing spectacularly like it should. Tim Kuehn
Continue reading...
Continue reading...