Using aliases in index files 
Author Message
 Using aliases in index files

I've inherited some code to maintain (5.2e) in which indexes are used (.ntx)
containing aliases referencing the data file being indexed.  For example I
have a data file called member.dbf with an index containing the key
member->ssn.  What would be the pros and cons of doing such a thing?  The
reason I ask is because we are converting delphi using The Advantage
Database Server and the latest version of ADS doesn't like aliases in the
index keys.  So, I'm trying to get some ideas of what areas to look for in
the code that might be broken by removing the aliases from the key
expressions.  Any ideas?

TIA for any suggestions!

Fleet Senseman



Sat, 27 Jul 2002 03:00:00 GMT  
 Using aliases in index files
I dont think that putting aliases in index keys is a very
inteligent thing to do. Imagine you want to pop-up a second
browse somewhere on the screen of the same dbf but in a
different key. Normally you would do:

use mydbf index myindex
(first browse)

use mydbf alias my2dbf index myindex
(2nd browse)

Since My2dbf has a key that reads "mydbf->xxx" your second
browse wont work.
If you must alias the key just do a
index on field->xxx to whatever

my 2 cents...

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Sat, 27 Jul 2002 03:00:00 GMT  
 Using aliases in index files
I can only imagine one reason why an index expression would have aliases in
it: A combination of using /ES2 when compiling and not wanting to have to
declare the fields used in the index expressions using a FIELD command.
--
David G. Holm


Tue, 30 Jul 2002 03:00:00 GMT  
 Using aliases in index files
Maybe I don't understand the question, but I think i use alaises all
the time in my apps.  I always open my files with an alais because I
may have several companys in the same app. So, I name the files with
the first four characters as the company name and the last four
characters as the type of file it is.  Like- SEDACUST.DBF alais
customer.  Now my index file is like- index on customer->name to
whatever.  Haven't had a bit of trouble with this.. The actual
indexing is a little more complicated because I include the gas gage.

Hope this helps

Martin



Quote:
>I can only imagine one reason why an index expression would have aliases in
>it: A combination of using /ES2 when compiling and not wanting to have to
>declare the fields used in the index expressions using a FIELD command.

regards Martin Hellar



Thu, 01 Aug 2002 03:00:00 GMT  
 Using aliases in index files
Unless I am misunderstanding the point, I can see major reasons why you may
want to index on aliased expressions.  I do it all the time.  In particular,
when you have a DBF with a SET RELATION INTO another dbf for sorting a
report and you index on combinations of fields from the 2 dbfs.

eg INDEX ON SALES->PRODNO + CUST->CUST_TYPE  ..

What is the problem with this?  (Or have I misunderstood?)

Colin Wisbey



Quote:
> I can only imagine one reason why an index expression would have aliases
in
> it: A combination of using /ES2 when compiling and not wanting to have to
> declare the fields used in the index expressions using a FIELD command.
> --
> David G. Holm



Fri, 02 Aug 2002 03:00:00 GMT  
 Using aliases in index files
Colin

Quote:
> eg INDEX ON SALES->PRODNO + CUST->CUST_TYPE  ..

> What is the problem with this?  (Or have I misunderstood?)

Not good practice IMHO, not even to set relatonships.

How do you keep this index upto date (without rebuilding it from scratch)
when there are changes in the CUST file (assuming this index is built on the
SALES dbf).

The reason not to use ALIASs in index expressions is there is no guarantee
that the alias will be the same when you have the database opened two or
more times.

eg
USE FRED ALIAS 'XXXX' NEW
INDEX ON XXXX->FIELD1 TAG FRED1

USE FRED ALIAS 'YYYY' NEW
SET ORDER TO FRED1
// This will more than likely fail when you try to do anything

You may not do this currently in your Clipper app, but when you move to
windows where you can have multiple windows open tied to the same DBF file
then an ALIAS in your index expression will cause you lots of problems
because each instance will have a different alias internally.

--
HTH
Steve Quinn
Are part-time band leaders semi-conductors?
Do jellyfish get gas from eating jellybeans?
How do you write zero in Roman numerals?
How many weeks are there in a light year?



Fri, 02 Aug 2002 03:00:00 GMT  
 Using aliases in index files

Quote:

> when you have a DBF with a SET RELATION INTO another dbf for sorting a
> report and you index on combinations of fields from the 2 dbfs.

> eg INDEX ON SALES->PRODNO + CUST->CUST_TYPE  ..

Now I know two reasons to include an alias in an index expression...
--
David G. Holm


Fri, 02 Aug 2002 03:00:00 GMT  
 Using aliases in index files
Check also for the function:

DBCREATEINDEX()      or just the 1st 10 significant chars...

- Kevin.
___________________________________________

O||||O   Its a jeep thing - - You wouldn't understand...
()()


Quote:
> As further comment, after reading the posts which followed my original, I
> would like to add that there appears to be no code that creates indexes.
In
> other words the indexes in use were created at the systems inception and
> there are no "index on... " statements within the code itself.  So, it
> appears no harm will be done in removing the alias-> portion from the
index
> key.  Thanks to all for your comments.

> Fleet

> > index keys.  So, I'm trying to get some ideas of what areas to look for
in
> > the code that might be broken by removing the aliases from the key
> > expressions.  Any ideas?
> > Fleet Senseman



Sat, 03 Aug 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Update an INDEXED FILE using SEQ FILE

2. How to remove duplicate records from dbf file (uses unique index)

3. Using an INDEX FILE in a program

4. Prob w/ separate index file using AcuCobol-85

5. Reading Indexed Files Using Alternate Keys

6. ALIAS files and File Drivers in CW2003

7. Alias TPS with different path/file name than original file

8. CDX Index file bloats up but shrink after re-indexing

9. To Alias or not to Alias

10. Why not alias an alias?

11. alias component(Not alias language construct)

12. Using Alias with Drop Down Combo

 

 
Powered by phpBB® Forum Software