Board index » delphi » Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)

Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)

Has anyone had problems with indexing and seeking on conditional indexes
with Apollo 2.0 and Foxpro 2.6 databases.  Normal indexes (i.e. index on
lastname tag lastname) work fine, but when a conditional index (i.e. index
on alltrim(lastname) + ',' + alltrim(firstname) tag lastfirst) is
used, Apollo will either seek incorrectly, or it will seek the first
record properly but{*word*222}up the order of the index for any records before
or after the seek.  I am running under Windows 95 so this may be a factor,
but Apollo tech support seems to be unable to come up with an answer
(their response time is about three weeks per suggestion).  In any case a
solution would be greatly appreciated!

Thanks in advance

 

Re:Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)


Correction:  I used the term conditional index improperly.  This is really
an expression index, but the question still applies.

Re:Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)


Re:Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)


Quote
>Has anyone had problems with indexing and seeking on conditional indexes  
>with Apollo 2.0 and Foxpro 2.6 databases.  Normal indexes (i.e. index on  
>lastname tag lastname) work fine, but when a conditional index (i.e. index
>on alltrim(lastname) + ',' + alltrim(firstname) tag lastfirst) is  
>used, Apollo will either seek incorrectly, or it will seek the first  
>record properly but{*word*222}up the order of the index for any records before
>or after the seek.  I am running under Windows 95 so this may be a factor,
>but Apollo tech support seems to be unable to come up with an answer  
>(their response time is about three weeks per suggestion).  In any case a  
>solution would be greatly appreciated!

>Thanks in advance  

The reason for your problems is that using the ALLTRIM function results in
an index key of an arbitrary length.  This true even in FoxPro.  What you
need to do is create your index using fixed length strings throughout.  In
other words, use Lastname + Firstname.

Jose' Perez
jope...@delphi.com

Re:Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)


Using Alltrim in a Foxpro 2.6 index works perfectly.  Foxpro may simply
pad any additional spaces, but nevertheless the functionality makes it
transparent to the user.  Apollo, on the other hand doesn't work at all.  
The purpose for wanting to use Altrim(Firstname) + ' ' + Alltrim(Lastname)
is so that the user can seek on the full name without having enter the
additional spaces (i.e. "john               Smith          "), so
alltrim(firstname) + alltrim(lastname) won't work for me.  

Any other suggestions?

Re:Promblems with Apollo 2.0 and conditional indexes (Foxpro 2.6 .DBF)


Quote
>Using Alltrim in a Foxpro 2.6 index works perfectly.  Foxpro may simply  
>pad any additional spaces, but nevertheless the functionality makes it  
>transparent to the user.  Apollo, on the other hand doesn't work at all.  
>The purpose for wanting to use Altrim(Firstname) + ' ' + Alltrim(Lastname)

Experience and Microsoft tech support indicate otherwise.  Use of ALLTRIM
results in a string that may or may not be padded out to an arbitrary
length.  The index key must be a fixed length string.  Using ALLTRIM
generates a variable length string.

Quote
>is so that the user can seek on the full name without having enter the  
>additional spaces (i.e. "john               Smith          "), so  
>alltrim(firstname) + alltrim(lastname) won't work for me.  

>Any other suggestions?

If you are going to insist on using ALLTRIM, then you will have to pad out
the index key with spaces:  ALLTRIM( firstname) + ' ' + ALLTRIM( Lastname )
+ Space( 49 - LEN( ALLTRIM( Firstname ) + ALLTRIM( Lastname ) ))

Other Threads