Returning a partial string

jda jda at his.com
Fri Jul 8 12:08:21 CDT 2005


Hi Ruslan,

So far, no success. Here is what I tried:

I added this to the table:

   firstAuthorSortMethod = CreateTextField("firstAuthorSortMethod", 
128, EVFlag.fNullable, "Left(authorsSortMethod, (LOCATE(chr(13), 
authorsSortMethod)))")

where

   authorsSortMethod = CreateTextField("authorsSortMethod", 128, 
EVFlag.fNullable, "left(authors, 256)")


Then in my code, I used:


select firstAuthorSortMethod,thedateSortMethod, * from thereferences 
where hit>0 ORDER BY firstAuthorSortMethod,thedateSortMethod


(I also tried ORDER BY 1,thedateSortMethod)

The result is not sorted at all (or at least there is no pattern I can see).

What am I doing wrong?

Jon



>  > SELECT * from table ORDER BY Left(textField, (LOCATE(chr(13), textfield)))
>>
>>  looks like it might retrieve the first name, but would get nothing if
>>  there was no return char.
>>
>>  Any ideas?
>
>First of all, I'd suggest put this formula into Table Method,
>Because they you get permanent index on it.
>
>Second, I think it needs put formula into SELCT
>And use
>   
>     ORDER 12
>
>Or give it in select alias name
>
>
>SELECT Left(textField, (LOCATE(chr(13), textfield))) as 'aaa'
>FROM T
>ORDER BY aaa


More information about the Valentina-beta mailing list