FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Other problem to Ordercreate and descend
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Other problem to Ordercreate and descend
Posted: Mon Feb 07, 2022 10:54 AM
Many year ago I made a function to make a index temporaney into xbrowse



Now I wish converte it for use with tdatabase and I have some problems

When the user slect the combox the the procedure create an Expression (cExpression)

sample : upper(code1)+name+DTOS(date)


TO create the index on oldest release I made

Code (fw): Select all Collapse
 

IF! ldescend
       INDEX ON &cExpression  TAG neworder  FOR !DELETED()  MEMORY ADDITIVE
 ELSE
         INDEX ON DESCEND(&cExpression)  TAG neworder  FOR !DELETED() MEMORY ADDITIVE
   Endif



With Tdatabase oDbf

local cfor := "!Deleted()"
local bFor := "{ || " + cfor + "}"

//take the fields

cExpression:=""
IF !Empty(cField1 ) .and. !Empty(cField2 ) .and. !Empty(cField3)
cExpression:=(cCampo1 +'+'+cCampo2+'+'+cCampo3)
elseif !Empty(cField1 ) .and. !Empty(cField2 )
cExpression:=(cCampo1 +'+'+cCampo2)
elseif !Empty(cField1 )
cExpression:=(cCampo1)
Endif

//ordcreate
bCode := "{ || " + cExpression + "}"

OrdCondSet(cFor,bFor,,,,, RECNO(),,,, )
OrdCreate( , cneworder, cExpression, &bCode )


but give me an error
Workarea not in use: ORDCREATE
but if I made ?oDbf:used give me .t.
How I can resolve it ?


I tried also with

cIndexFile := "temp.cdx"
cTagName := cneworder
cIndexKey := cExpression
bIndexKey := &bCode
lUnique := .f.
lAdditive :=.t.

OrdCreate(cIndexFile ,cTagName ,cIndexKey , bIndexKey , lUnique ,lAdditive )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Other problem to Ordercreate and descend
Posted: Mon Feb 07, 2022 11:02 AM
Please, use:

Code (fw): Select all Collapse
oDbf:CreateIndex(cFile, cTag, cKey, lUnique, lDescend, lMemory)


OR

Code (fw): Select all Collapse
(oDbf:cAlias)-> ( OrdCondSet(cFor,bFor,,,,, RECNO(),,,, ) )
(oDbf:cAlias)-> ( OrdCreate( , cneworder, cExpression, &bCode ) )
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Other problem to Ordercreate and descend
Posted: Mon Feb 07, 2022 11:45 AM
hmpaquito wrote:Please, use:

Code (fw): Select all Collapse
oDbf:CreateIndex(cFile, cTag, cKey, lUnique, lDescend, lMemory)


OR

Code (fw): Select all Collapse
(oDbf:cAlias)-> ( OrdCondSet(cFor,bFor,,,,, RECNO(),,,, ) )
(oDbf:cAlias)-> ( OrdCreate( , cneworder, cExpression, &bCode ) )



thanks run ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Other problem to Ordercreate and descend
Posted: Mon Feb 07, 2022 12:00 PM
You can also use:

Code (fw): Select all Collapse
EXTERNAL DESCEND

FUNCTION ReIndexa( DeOndeVem )
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion