Algunas consultas sobre indices

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
mrclinker
Posts: 3
Joined: Tue Jul 14, 2009 5:15 pm

Algunas consultas sobre indices

Post by mrclinker »

Estimados amigos:

Mirando atentamente los ejemplos provistos en HMG, he podido convertir satisfactoriamente una rutina de mantenimiento de clientes originariamente escrita para Clipper 5.2, (convertir es un decir, ya que práctimante reescribí todo de nuevo, pero con una apariencia visual impresionante y casi 10 veces menos de código...) pero tengo algunas preguntas sobre los índices:

1) La vieja tabla clientes.dbf la abrí en Visual FoxPro 9, y creé nuevamente los índices en esta aplicación, con lo cual ahora tengo un archivo clientes.cdx
¿Si en HMG abro la tabla clientes, sin indicar ningún índice, y realizo un append, automáticamente se me actualizan los índices, o específicamente tengo que abrirlos?

2) ¿Existe algo similar al "Set Softseek On" de Clipper, en la que una búsqueda indexada se posicionaba en el registro más próximo al criterio de búsqueda?

3) ¿Cómo puedo hacer para buscar un texto string en un campo apellido en en una tabla, y que me devuelva un browse con todas los registros coincidentes, conteniendo dicha cadena en cualquier parte del apellido. Por ejemplo si busco "LOP", que me devuelva los registros de "Lopez", "Alopez", "Montes Lopez", etc.

Bueno, espero no abusar de vuestro conocimiento.

Un abrazo,

Mr. Clinker
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Algunas consultas sobre indices

Post by esgici »

http://translate.google.com wrote:Dear friends:

Looking closely at the examples provided in HMG, I was able to successfully convert a routine maintenance customers originally written for Clipper 5.2, (a convert is to say, as práctimante rewrote everything again, but with a stunning visual appearance and almost 10 times less code ...) but I have some questions about the rates:

1) The old clientes.dbf the table opened in Visual FoxPro 9, and create new indexes in this application, which I now have a file clientes.cdx
If I open the table in HMG customers, without specifying any index, and append a place, I was automatically updated indexes, or should I open them specifically?

2) Is there something similar to "Set Softseek On" Clipper, in which a search index is positioned at the register closest to the query?

3) How can I search a text string in a field name in a table, and I browse a return with all the matching records containing that string anywhere in the surname. For example searching for "LOP", I return the records of "Lopez", "Alopez, Montes Lopez," and so on.

Well, I hope not to abuse your knowledge.

Un abrazo,

Mr. Clinker
Hola Mr. Clinker

Answer 1: Normally yes. Because USE statement in Harbour automatically detect RDD of DBF and automatically open .cdx indexes. But, it's recommended

- REQUEST DBFCDX

statement for invoking appropriate library and than

- RDDSETDEFAULT( "DBFCDX" )

for setting default RDD;

OR explicitly declare RDD in the USE command or DBUSEAREA() function.

fe :

USE clientes VIA "DBFCDX"

OR

DBUSEAREA( ,"DBFCDX","clientes" )

Answer 2: "Set Softseek On" command of Clipper is supported by Harbour; exactly same as all Clipper commands. And exactly same as Clipper you can add .T. to SEEK command and DBSEEK() function for soft seek.

Ansver 3 :

a) Exactly same as Clipper; "LOP",

return the records of "Lopez" by SEEK command or DBSEEK() function, if your index key of index file include UPPER()
function, AND by SOFT SEEK;

return "Lopez", "Alopez", "Montes Lopez," and so on, by LOCATE command,

f.e: LOCATE FOR "LOP" $ UPPER(<keyFieldName>)

b) For "browse a return with all the matching records", you may

- FILTER the table by search statement fe:

SET FILTER TO "LOP" $ UPPER(<keyFieldName>)

OR

- Build an intermediate table fe

COPY TO <tempTableName> FOR "LOP" $ UPPER(<keyFieldName>)

and than browse <tempTableName>.

In summary:

All database operations of Clipper are exactly valid in Harbour. There are many extras but there isn't (almost) any lack.

Happy HMG'ing 8-)


Saludos

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply