FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Stupid question about temp index ...
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Stupid question about temp index ...
Posted: Sun May 10, 2009 06:11 PM

Hi ,

Maybe this can be done what I wanna ... :) There are 2 tables ( DBFCDX RDD ) - 1-st header of documents and 2-nd - variuos items in documents . The relation between them is Doc_Id . The first table have field DocDate . To speed some search of movement of needfull item in needful month it can be better in this way - DocItms->ITEM + dtos( DocJourn->DocDate ) ... But I don't - it's possible or not . At this time I'm running seacrh through period of documents and looking inside DocItms ( dbseek( DocJourn->Doc_Id + cNeedFullItem ) ...

Many thanks in advance ...

Rimantas U.
Posts: 208
Joined: Wed Dec 03, 2008 04:48 PM
Re: Stupid question about temp index ...
Posted: Mon May 11, 2009 01:33 AM

Rimantas,

Did you think about using RELATIONS ?

Boris

Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: Stupid question about temp index ...
Posted: Mon May 11, 2009 06:16 AM
codemaker wrote:Rimantas,

Did you think about using RELATIONS ?

Boris


As I know , without RELATION it can't to do . Question here - how good speed will be relating two tables and it's possible to build temp index on this related tables ?
Rimantas U.
Posts: 989
Joined: Thu Nov 24, 2005 03:01 PM
Re: Stupid question about temp index ...
Posted: Wed May 13, 2009 01:42 PM
Hi Rimantas,

I'm doing exactly what you ask. I have the same problem: a table with clients(Id PK) and a table with TaxForms ( TaxId, Period, ClientID ). I have to show a browse with all the forms for a given Tax and Period... but the browse should be ordererd by ClientId OR Clients->ClientName. So I build a new pair of temporary indexes using FOR ... WHILE to make them faster. Following the piece of code.

Code (fw): Select all Collapse
  

 Select M303

   Set Relation To Field->CodEmp Into Empresas

   // Index On Field->CodEmp Tag 'TCodEmp' For Field->Ejercicio == cAnio Temporary
   ordCondSet( "Field->Ejercicio == '"+cAnio+"'.and. Field->Periodo == '"+cPeriodo+"'", &( "{|| Field->Ejercicio == '"+cAnio+"'.and. Field->Periodo == '"+cPeriodo+"'}"),,,,, RECNO(),,,,,,,,,,, .T.,, )
   ordCreate(, "TCodEmp", "Field->CodEmp", {||Field->CodEmp}, )

   // Index On Field->Empresas->Empresa Tag 'TEmpresa' For Field->Ejercicio == cAnio Temporary
   ordCondSet( "Field->Ejercicio == '"+cAnio+"'.and. Field->Periodo == '"+cPeriodo+"'", &( "{|| Field->Ejercicio == '"+cAnio+"'.and. Field->Periodo == '"+cPeriodo+"'}"),,,,, RECNO(),,,,,,,,,,, .T.,, )
   ordCreate(, "TEmpresa", "Empresas->Empresa", {||Empresas->Empresa}, )

   Go Top


This works OK. I have used the functional form of INDEX because I replaced the variable part of the filter expresion with constants.

Hope this helps,

Carlos.
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: Stupid question about temp index ...
Posted: Thu May 14, 2009 08:56 AM
Carlos Mora wrote:Hi Rimantas,

I'm doing exactly what you ask. I have the same problem: a table with clients(Id PK) and a table with TaxForms ( TaxId, Period, ClientID ). I have to show a browse with all the forms for a given Tax and Period... but the browse should be ordererd by ClientId OR Clients->ClientName. So I build a new pair of temporary indexes using FOR ... WHILE to make them faster. Following the piece of code.
...
Hope this helps,

Carlos.



Many thanks to you , Carlos ! A ver good sample !
Rimantas U.

Continue the discussion