Recent

Author Topic: dbase and indices [SOLVED]  (Read 14195 times)

timcs

  • Full Member
  • ***
  • Posts: 213
Re: dbase and indices
« Reply #15 on: September 10, 2012, 10:31:50 pm »
no.  I want you to index on two fields that are string types without any type casting using the plus sign.  It looks like you have two issues right now.
1. building an index with two or more fields
2. building an index using a date field

Yes, you want them all together, but let's at least isolate the two issues.  If you can build the index with two string fields, then we are hald way home.

In that case I can test two fields in the database that are string and set these with the plus sign and then I could try and create a further index just with the date field and see what happens

Knipfty

  • Full Member
  • ***
  • Posts: 232
Re: dbase and indices
« Reply #16 on: September 10, 2012, 10:45:06 pm »
Yes!  Exactly!
64-bit Lazarus 2.2.0 FPC 3.2.2, 64-bit Win 11

timcs

  • Full Member
  • ***
  • Posts: 213
Re: dbase and indices
« Reply #17 on: September 10, 2012, 10:58:54 pm »
Yes!  Exactly!

Okay, I have been able to create an index using two string fields and the plus symbol, I have then tried to create a separate index using the date field and as expected it errors stating the field must be string or float. So the question is, how to create an index with a date field !

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: dbase and indices
« Reply #18 on: September 11, 2012, 10:37:55 am »
Tdbf is actually well documented: http://sourceforge.net/projects/tdbf/files/TDbf%20documentation/TDbf%20documentation%201.1/

There is also a nice demo: http://sourceforge.net/projects/tdbf/files/TDbf%20Demo%20App/

So far I've been able to find everything I needed there. If something happens to be unclear, there is always the source at hand. ;)
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

timcs

  • Full Member
  • ***
  • Posts: 213
Re: dbase and indices
« Reply #19 on: September 11, 2012, 11:29:03 am »
Tdbf is actually well documented: http://sourceforge.net/projects/tdbf/files/TDbf%20documentation/TDbf%20documentation%201.1/

There is also a nice demo: http://sourceforge.net/projects/tdbf/files/TDbf%20Demo%20App/

So far I've been able to find everything I needed there. If something happens to be unclear, there is always the source at hand. ;)

Thanks for this TurboPascal - I will read these and hopefully get this  working!

timcs

  • Full Member
  • ***
  • Posts: 213
Re: dbase and indices [SOLVED]
« Reply #20 on: September 11, 2012, 01:46:02 pm »
I think one of the first answers here was the answer but I didn't use the DTOS function correctly. so I can do this:

Code: [Select]
   dbf1.Active:=false;
   dbf1.Exclusive:=true;
   dbf1.Open;
   dbf1.AddIndex('custdate','field1+'+'DTOS(datefield)',[ixCaseInsensitive]);
   dbf1.Close;
   dbf1.Exclusive:=false;
   dbf1.Active:=true;     

This appears to work now, thanks for everyone's help here

 

TinyPortal © 2005-2018