tDataBase

tDataBase

Postby Colin Haig » Tue Oct 13, 2009 10:11 am

Hi All

I an using this code to create my indexes

Code: Select all  Expand view
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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: tDataBase

Postby Antonio Linares » Tue Oct 13, 2009 10:45 am

Colin,

The fourth parameter of Method CreateIndex has to be a codeblock:
Code: Select all  Expand view

METHOD CreateIndex( cFile, cTag, cKey, bKey, lUnique )
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: tDataBase

Postby Colin Haig » 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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Willi Quintana and 47 guests