Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create index
Message
From
25/04/2007 07:32:09
 
 
To
25/04/2007 07:25:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01219687
Message ID:
01219689
Views:
9
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform