Page 1 of 2
Indexing a DBF
Posted: Sun Mar 25, 2018 12:30 pm
by asharpham
I'm experienced with Clipper but am an absolute novice with HMG/Harbour. My attempts to open a DBF file with an Index (NTX) utterly fails.
The line "USE <dbf> INDEX <Index>" just doesn't seem to work. The database file opens okay but not in the indexed order. I've tried a variety of methods but my understanding is still too limited to "translate" from Clipper.
Can someone offer a suggestion? I have a lot to learn and am happy to struggle through but occasionally I get stuck on something simple like this. By the way, I have never tried programming in a Windows environment before.
Regards,
Alan
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 1:16 pm
by trmpluym
I use:
USE <dbf> NEW SHARED INDEX <index>
But can you post a sample ?
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 2:08 pm
by serge_girard
Hi Alan,
First: welcome from Belgium!
Theo's suggestion should work. Maybe you should reindex before. USE syntax has not changed in Harbour/Windosw/HMG so it should work.
Regards, Serge
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 4:03 pm
by asharpham
Hi guys. Thanks so much for your welcome and your suggestion. I realised after I got your replies that I hadn't created the indexes for the new DBF file I'd created. I had been working off an old clipper program I wrote about 20 years ago and then decided to modify it greatly using a new database file.
So I've created 2 indexes. Is there a simple way to view the database via an Index without writing a heap of code? I can view the database with LibreOffice Calc but this doesn't give me the indexed list. I'm still very much in testing mode.
Alan
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 4:27 pm
by edk
Try this:
Code: Select all
use test index test1
EDIT EXTENDED WORKAREA test
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 4:43 pm
by asharpham
Thanks so much. It's easy when you know how!
Regards,
Alan
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 5:26 pm
by asharpham
Okay last question for the night - (Yes, it's night here in Australia) - I've set up a LABEL / TEXTBOX to get user input to be added to the database. How do I save the TEXTBOX input to the database? The old READ statement in Clipper was so simple!
Alan
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 6:01 pm
by serge_girard
Hi Alan,
Several ways:
I useally take a 'copy' of the database edit fields. Then a button in order to validate etc. and then my update with the edit-field.
Others use browse and then you can update immediatly.
So it depends on how you will edit!
Samples enough in the samples.
Serge
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 7:31 pm
by mol
Use this code:
Code: Select all
Append blank;
Replace;
Field1 with Form1.Text1.Value,;
Field2 with Form1.Text2.Value
Re: Indexing a DBF
Posted: Sun Mar 25, 2018 9:23 pm
by dragancesu
Hello asharpham
HMG uses a clipper syntax and the transition should be relatively easy but as it says: every start is difficult
Believe that we all passed it, but the effort is worth it, you will get a lot
Look at the topic I've opened a long time ago, a program that will generate a simple program to work with your dbf table
http://hmgforum.com/viewtopic.php?f=10&t=4170