N
Nigel Allen
Guest
Antipodean salutations. I just spotted this in another forum from Tom B. FOR LAST is a very deceptive statement. (So is FOR FIRST.) It does not behave in an intuitive manner. The sort order is NOT specified by the BY statement. You will get the LAST record according to the index which is used and no sorting will take place. When the BY refers to an unindexed field (or one which does not sort in the order of the index actually used) or when the WHERE clause does not obviously map to an index in the order that you are hoping for you will have mysterious records chosen. Personally, I strongly suggest that you forget about using FOR FIRST & FOR LAST. A better option, which always sorts as expected, would be: FOR EACH tableName WHERE someCriteria BREAK BY sortOrder: LEAVE. END. DISPLAY whatEver. (Add "DESCENDING" to flip from FIRST to LAST...) My question (to anyone) is: Why "BREAK" instead of simply "BY"? Rgds N/
Continue reading...
Continue reading...