>Hi,
>I have a field1(c,10) and I'd like to create an index on it. The field looks like this: "BA12345607", and the index should consist of the last two characters showing the year, and then the six characters from the middle showing the sequential number and the first two letters showing a sequence as well.
>I've tried to join the three together like this,
>
> INDEX ON VAL(SUBSTR(ALLTRIM(field1),9,2)+SUBSTR(ALLTRIM(field1),3,8))+ SUBSTR(ALLTRIM(field1),1,2) TO indx
>
>but it didn't work. Joining the first two is ok. Can I join the three in one anyway?
>
>Thanks
>Tamas
You are trying to add or concatenate a number with a string which isn't possible. Leave out the val() function and it will work :
INDEX ON SUBSTR(ALLTRIM(field1),9,2)+SUBSTR(ALLTRIM(field1),3,8) + SUBSTR(ALLTRIM(field1),1,2) TO indx