Maximum Length of any Field
Peter De Berdt
peter.de.berdt at pandora.be
Wed Nov 12 12:12:20 CST 2003
Using RB 5.2.1 and V4RB.
I'm trying to accomplish the following:
I want to calculate the stringwidth of the longest record in some
table. I can then pass back this integer value to Einhugur's DataGrid
to define the columnwidth. This would allow me to create a generic
class that automatically adjusts columnwidths to the longest string
in the cursor.
However, when I try the following SQL, I don't get any results:
myCursor=myDB.SQLSelect("SELECT MAX(LENGTH(myField)) FROM myTable")
It goes even further, when I try to get the length of the fields, no
results are returned:
myCursor=myDB.SQLSelect("SELECT LENGTH(myField) FROM myTable")
If this worked, I could use
myCursor=myDB.SQLSelect("SELECT LENGTH(myField) FROM myTable ORDER BY
LENGTH(myField) DESC") and take the value of the first record.
I tried replacing LENGTH with LEN (as this is used throughout most
other SQL databases), but it doesn't help. Searching using google how
to determine the longest string also brings up "SELECT
MAX(LEN(myField)) FROM myTable", so normally it should work, or am I
wrong here?
--
Best regards,
Peter De Berdt
--------------
My software never has bugs, it just generates random features...
More information about the Valentina
mailing list