FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour tDataBase
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
tDataBase
Posted: Tue Oct 13, 2009 10:11 AM
Hi All

I an using this code to create my indexes

Code (fw): Select all Collapse
function Maintmod(oMainWnd,cPath)
local oDb,oIndex
oIndex := tdatabase():new(,cPath + "indfile")
if oIndex:use()
   do while ! oIndex:eof()
      CursorWait()
      oDb := tdatabase():new(,cPath + alltrim(oIndex:datafile))
      if oDb:use()
         oDb:pack()
         oDb:CreateIndex(alltrim(oIndex:datafile),alltrim(oIndex:tagname),alltrim(oIndex:key),if(!empty(oIndex:cond),alltrim(oIndex:cond),))
      endif
      oDb:Close()
      oIndex:skip()
   enddo
   oIndex:Close()
   SysRefresh()
   CursorArrow()
endif
return(nil)

The indexes are created but the when I use an index with a for condition (oIndex:cond) it does not work according to the condition.

Regards

Colin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: tDataBase
Posted: Tue Oct 13, 2009 10:45 AM
Colin,

The fourth parameter of Method CreateIndex has to be a codeblock:
Code (fw): Select all Collapse
METHOD CreateIndex( cFile, cTag, cKey, bKey, lUnique )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: tDataBase
Posted: Tue Oct 13, 2009 12:17 PM

Hi Antonio

I changed to this

oDb:CreateIndex(alltrim(oIndex:datafile),alltrim(oIndex:tagname),alltrim(oIndex:key),{||if(!empty(oIndex:cond),alltrim(oIndex:cond),oIndex:cond)})

the indexes are created but when I use an index which has a condition it does not work.

Regards

Colin

Continue the discussion