Alaska Software Inc. - Creating Indexes
Username: Password:
AuthorTopic: Creating Indexes
Joe Carrick Creating Indexes
on Tue, 17 Aug 2010 07:40:31 -0700
I'm using DBFCDX database engine and have a question about how to insure 
Indexes are created properly.

In many cases I use the same name for Temp Files using different 
structures.  For example:

cUserName+"_TempInvoice"

is used for both Customer & Vendor Invoices but the fields and index 
keys are not the same.  The dbf's are created by copying the structure 
of two different files.  When I then index the temp files using key 
expressions specific to that particular dbf the Index Name is the same 
as the File Name and there can be confusion (and potentially an error 
condition) if the current index file is for the wrong structure.  In 
most cases, I use 2-3 index orders within the index file so I want to 
have the 2nd and 3rd simply added to the index file but the first order 
created should result in a new index file, over-writing any prior index 
file.

How can I be sure that the Index is created "new" for the first order?

Thanks,  Joe
Raymond Re: Creating Indexes
on Tue, 17 Aug 2010 20:46:35 +0200
Joe Carrick a exposé le 17/08/2010 :
> I'm using DBFCDX database engine and have a question about how to insure 
> Indexes are created properly.
>
> In many cases I use the same name for Temp Files using different structures.  
> For example:
>
> cUserName+"_TempInvoice"
>
> is used for both Customer & Vendor Invoices but the fields and index keys are 
> not the same.  The dbf's are created by copying the structure of two 
> different files.  When I then index the temp files using key expressions 
> specific to that particular dbf the Index Name is the same as the File Name 
> and there can be confusion (and potentially an error condition) if the 
> current index file is for the wrong structure.  In most cases, I use 2-3 
> index orders within the index file so I want to have the 2nd and 3rd simply 
> added to the index file but the first order created should result in a new 
> index file, over-writing any prior index file.
>
> How can I be sure that the Index is created "new" for the first order?
>
> Thanks,  Joe

Hello Joe,

I am not sure I understand you correctly but...

When I create a new CDX index file or when I re-create the CDX index 
file, I always erase the existing one.
This is a must for CDX indexes otherwise the index file is not emptied 
and the space used for the old indexes is not recovered.
By erasing the index file, you also assure that the Index is created 
"new" for the first order.

Best Regards,
Raymond

Amicalement,
Raymond

http://www.mouches.org
http://www.cpmn.be
Igor FERKRe: Creating Indexes
on Wed, 29 Sep 2010 08:43:55 +0200
Joe,
try GetUniqueFileName()

From Xbase++ help:
"The function GetUniqueFileName() creates a unique file name. It can be used 
for creating temporary files using the low-level file functions, for 
example..."

And of course you should FErase() temp files after 

Regards,
Igor

"Joe Carrick" <joe.carrick@dslextreme.com> wrote in message 
news:5e8ab62e$1c9f9437$329f3@news.alaska-software.com...
> I'm using DBFCDX database engine and have a question about how to insure 
> Indexes are created properly.
>
> In many cases I use the same name for Temp Files using different 
> structures.  For example:
>
> cUserName+"_TempInvoice"
>
> is used for both Customer & Vendor Invoices but the fields and index keys 
> are not the same.  The dbf's are created by copying the structure of two 
> different files.  When I then index the temp files using key expressions 
> specific to that particular dbf the Index Name is the same as the File 
> Name and there can be confusion (and potentially an error condition) if 
> the current index file is for the wrong structure.  In most cases, I use 
> 2-3 index orders within the index file so I want to have the 2nd and 3rd 
> simply added to the index file but the first order created should result 
> in a new index file, over-writing any prior index file.
>
> How can I be sure that the Index is created "new" for the first order?
>
> Thanks,  Joe
>
>