Hi,
I have a table and I want to retrieve the maximum value of a code field.
My code field values are 1 - 10.
I sort my table but FINDLAST retrieves always the value 9 because the value 10 is under the value 1. What can I do to retrieve the correct value?
Thank you.
kirkostas™
0
Answers
WITH recTable DO BEGIN
ASCENDING(TRUE);
IF FIND('+') THAN
MESSAGE(Code);
END;
If you have "B1" and "A10" as values for example, what do you consider to be the largest value?
I have the same problem again. The sorting order of the table is:
1
10
2
3
4
5
6
7
8
9
and I want to get the value 10 but it returns me the value 9.
So may be change type to integer
or need repeat-until search
As i see from your code you are trying to migrate data in your tax office table. This must be done once or multiple times?
fidel I have added you in my Skype account if you want to discuss a little more.
Alternative is to use a REPEAT .. UNTIL construction to loop through all records, and use a IF rec.Codefield > intLargestValue THEN intLargestValue := rec.Codefield statement to store the largest value in a variable.
This is how SQL sorts code fields. If it really is only 10 values, you could o it in code. If its a lot more, then set the Sort type to Integer in the Table designer.
But I think you create a job where does not get the no from the No.Series to set that code values to same length... :?
Is any idea how can I set the SQL database (without any programming) to the correct sorting?
I cannot believe that is not any settings to solve this problem. Or this is only my problem
Go to properties for the field and change "SQL Data Type" to integer.
Thank you all =D>