If you need the value fast, without searching the whole DB, the method of HalMdy is ok.
But if you don't need the value so fast, it is better to avoid creating keys for the mimimum thing, because to many keys can lead to performance issues.
You might also try :
recTable.RESET;
IF recTable.FIND('-') THEN BEGIN
xxxSmallestValue := recTable."Some Field";
REPEAT
IF xxxSmallestValue > recTable."Some Field" THEN
xxxSmallestValue := recTable."Some Field";
UNTIL recTable.NEXT = 0;
END;
This will be slow in finding the smallest value, but writing in the table will not be slowed down. (Every key in a table slows down the writing to the table)
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
If you do not want to create a new key :
You can also create a temporary table with one field ( any free Table ID in the customer range 50000..99999 is possible , temporary tables are not checked by the licence), copy the field values to this table
( use "If insert then;" to avoid insert errors for double values)
and then do a "Find('-')" on the temporary table.
Comments
Then :
Table.SETCURRENTKEY(newKey);
Table.FIND('-');
You are on the record with the smallest value ...
That's works if the field is not a flowfield, of course ...
But if you don't need the value so fast, it is better to avoid creating keys for the mimimum thing, because to many keys can lead to performance issues.
You might also try :
This will be slow in finding the smallest value, but writing in the table will not be slowed down. (Every key in a table slows down the writing to the table)
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
You can also create a temporary table with one field ( any free Table ID in the customer range 50000..99999 is possible , temporary tables are not checked by the licence), copy the field values to this table
( use "If insert then;" to avoid insert errors for double values)
and then do a "Find('-')" on the temporary table.