Other problem to Ordercreate and descend

Other problem to Ordercreate and descend

Postby Silvio.Falconi » Mon Feb 07, 2022 10:54 am

Many year ago I made a function to make a index temporaney into xbrowse

Image

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: Select all  Expand view  RUN


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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Other problem to Ordercreate and descend

Postby hmpaquito » Mon Feb 07, 2022 11:02 am

Please, use:

Code: Select all  Expand view  RUN
oDbf:CreateIndex(cFile, cTag, cKey, lUnique, lDescend, lMemory)


OR

Code: Select all  Expand view  RUN
(oDbf:cAlias)-> ( OrdCondSet(cFor,bFor,,,,, RECNO(),,,, ) )
(oDbf:cAlias)-> ( OrdCreate( , cneworder, cExpression, &bCode ) )
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Other problem to Ordercreate and descend

Postby Silvio.Falconi » Mon Feb 07, 2022 11:45 am

hmpaquito wrote:Please, use:

Code: Select all  Expand view  RUN
oDbf:CreateIndex(cFile, cTag, cKey, lUnique, lDescend, lMemory)


OR

Code: Select all  Expand view  RUN
(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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Other problem to Ordercreate and descend

Postby karinha » Mon Feb 07, 2022 12:00 pm

You can also use:

Code: Select all  Expand view  RUN

EXTERNAL DESCEND

FUNCTION ReIndexa( DeOndeVem )
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 53 guests