Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #4971 > unrolled thread
| Started by | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| First post | 2013-03-27 06:06 -0700 |
| Last post | 2013-03-27 09:03 -0700 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Indexing with a progress bar "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2013-03-27 06:06 -0700
Re: Indexing with a progress bar dlzc <dlzc1@cox.net> - 2013-03-27 07:15 -0700
Re: Indexing with a progress bar "Jamal" <jamal@examples.net> - 2013-03-27 11:28 -0400
Re: Indexing with a progress bar "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2013-03-27 09:03 -0700
| From | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| Date | 2013-03-27 06:06 -0700 |
| Subject | Indexing with a progress bar |
| Message-ID | <5e5d3496-72c8-4b80-af4f-82122341f5ab@googlegroups.com> |
Hi everyone,
I'm trying to do as many people did on this newsgroup : Some index with a progress bar.
But i can't make it works.
I'm doing this :
METHOD CreateIndex(FileName) CLASS W_INDEXING
LOCAL aIndex := {} as ARRAY
LOCAL pos as DWORD
LOCAL i as DWORD
LOCAL oserver as DbServer
LOCAL lSuccess as LOGIC
LOCAL Max as DWORD
LOCAl oself as OBJECT
LOCAL cFor as STRING
LOCAL lAll, lRest, lDescend as LOGIC
LOCAL cbForCondition, cbWhileCondition, cbEval as USUAL
LOCAL nStep, nStart, nNext, nRecord as SHORTINT
// For condition string format
cFor := null_string
// Actual for condition
cbForCondition := nil
lAll := true
cbWhileCondition := {|| true} // While all
oself := self
cbEval := {||oself:CreateCDXProg()} // Indexing code
// block
nStep := 0 // Step through all
nStart := 0 // From top
nNext := 0 // All
nRecord := 0 // All records
lRest := FALSE // ALL
lDescend := FALSE // Ascending
aIndex := CreateIndexList()
pos := AScan(aIndex,{|aVal| aVal[1] = FileName} )
if pos > 0
oserver:= DbServer{oEnvObject:cPath+FileName+".dbf",DBEXCLUSIVE}
Max := oserver:Count()
oserver:gotop()
if oserver:used
FOR i:=1 to oserver:OrderInfo(DBOI_ORDERCOUNT)
oserver:DeleteOrder(i,null_string)
NEXT i
self:oDCProgressBar2:Range := Range{ 1 ,ALen(aIndex[pos][2]) }
self:Show()
for i:=1 to ALen(aIndex[pos][2])
self:oDCMultiLineEdit1:TextValue += crlf + "Processing Order "+ AsString(i) + " - " +aIndex[pos][2][i][1]
if i==1
self:oDCProgressBar1:Range := Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
lSuccess:= oserver:CreateIndex( aIndex[pos][1]+".cdx",aIndex[pos][2][i][2])
else
self:oDCProgressBar1:Range := Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
//lSuccess:= oserver:SetOrderCondition(null_string, null_string , , , {||oself:CreateCDXProg()},0)
RddSetDefault("DBFCDX")
oserver:SetOrderCondition(cFor, cbForCondition, lAll,cbWhileCondition, cbEval,nStep, nStart, nNext, nRecord, lRest, lDescend)
lSuccess:= oserver:createorder( Lower(aIndex[pos][2][i][1]),oEnvObject:cPath+aIndex[pos][1]+".cdx",Lower(aIndex[pos][2][i][2]))
endif
self:oDCProgressBar2:Advance(1)
next i
else
oserver:close()
return false
endif
oserver:close()
endif
return true
METHOD CreateCDXProg() CLASS W_INDEXING
ApplicationExec(EXECWHILEEVENT) // rgtr 090508
self:oDCProgressBar1:Advance(1)
self:oDCMultiLineEdit1:value += crlf + " Advance 1"
RETURN nil
But the function CreateCDX is only called once a time during the createOrder, and my code create the order, but don't index the file at all.
My windows says :
Processing Order 1 - CLIENT
Processing Order 2 - CLIENT_NU
Advance 1
Processing Order 3 - CLIENT_TV
Advance 1
Processing Order 4 - CLIENT_NV
Advance 1
Processing Order 5 - CLIENT_MA
Advance 1
If i remove the SetOrderCondition part, everything works pretty well but the windows freeze during the indexing of big files.
I wanted the CreateCDXProg function to be called each time a record (or maybe 100 records) is processed to leave the hand to the user and have the index done!
Any advice would be welcome!
Philippe
[toc] | [next] | [standalone]
| From | dlzc <dlzc1@cox.net> |
|---|---|
| Date | 2013-03-27 07:15 -0700 |
| Message-ID | <df0914bb-5fc5-4d41-8597-d075e3453b47@googlegroups.com> |
| In reply to | #4971 |
Dear Philippe Bayard: On Wednesday, March 27, 2013 6:06:11 AM UTC-7, Philippe Bayard (Belgium) wrote: ... > I'm trying to do as many people did on this > newsgroup : Some index with a progress bar. > > But i can't make it works. > > I'm doing this : ... > // For condition string format The problem is, "FOR" condition is parsed and stored with the index. So in reality, it must be available to every executable that uses that index. Sounds like it "shorts out" to that stored condition, and uses that for the balance of the operation. Try putting your status code in the WHILE, and return a true so the index continues. Be sure to only have a record number compare before return, and only update the progress bar a few tens of times (say each reccount() / 100 times) during the index operation... otherwise you add days to the indexing operation. I only do classic xBase, so I cannot really help with a code example. David A. Smith
[toc] | [prev] | [next] | [standalone]
| From | "Jamal" <jamal@examples.net> |
|---|---|
| Date | 2013-03-27 11:28 -0400 |
| Message-ID | <kiv37a$ctg$1@speranza.aioe.org> |
| In reply to | #4971 |
Hi Philippe,
CreateCDXProg() return value must be a logical value, try setting it to TRUE
not NIL.
HTH,
Jamal
"Philippe Bayard (Belgium)" wrote in message
news:5e5d3496-72c8-4b80-af4f-82122341f5ab@googlegroups.com...
Hi everyone,
I'm trying to do as many people did on this newsgroup : Some index with a
progress bar.
But i can't make it works.
I'm doing this :
METHOD CreateIndex(FileName) CLASS W_INDEXING
LOCAL aIndex := {} as ARRAY
LOCAL pos as DWORD
LOCAL i as DWORD
LOCAL oserver as DbServer
LOCAL lSuccess as LOGIC
LOCAL Max as DWORD
LOCAl oself as OBJECT
LOCAL cFor as STRING
LOCAL lAll, lRest, lDescend as LOGIC
LOCAL cbForCondition, cbWhileCondition, cbEval as USUAL
LOCAL nStep, nStart, nNext, nRecord as SHORTINT
// For condition string format
cFor := null_string
// Actual for condition
cbForCondition := nil
lAll := true
cbWhileCondition := {|| true} // While all
oself := self
cbEval := {||oself:CreateCDXProg()} // Indexing code
// block
nStep := 0 // Step through all
nStart := 0 // From top
nNext := 0 // All
nRecord := 0 // All records
lRest := FALSE // ALL
lDescend := FALSE // Ascending
aIndex := CreateIndexList()
pos := AScan(aIndex,{|aVal| aVal[1] = FileName} )
if pos > 0
oserver:=
DbServer{oEnvObject:cPath+FileName+".dbf",DBEXCLUSIVE}
Max := oserver:Count()
oserver:gotop()
if oserver:used
FOR i:=1 to oserver:OrderInfo(DBOI_ORDERCOUNT)
oserver:DeleteOrder(i,null_string)
NEXT i
self:oDCProgressBar2:Range := Range{ 1
,ALen(aIndex[pos][2]) }
self:Show()
for i:=1 to ALen(aIndex[pos][2])
self:oDCMultiLineEdit1:TextValue += crlf +
"Processing Order "+ AsString(i) + " - " +aIndex[pos][2][i][1]
if i==1
self:oDCProgressBar1:Range :=
Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
lSuccess:= oserver:CreateIndex(
aIndex[pos][1]+".cdx",aIndex[pos][2][i][2])
else
self:oDCProgressBar1:Range :=
Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
//lSuccess:=
oserver:SetOrderCondition(null_string, null_string , , ,
{||oself:CreateCDXProg()},0)
RddSetDefault("DBFCDX")
oserver:SetOrderCondition(cFor,
cbForCondition, lAll,cbWhileCondition, cbEval,nStep, nStart, nNext, nRecord,
lRest, lDescend)
lSuccess:= oserver:createorder(
Lower(aIndex[pos][2][i][1]),oEnvObject:cPath+aIndex[pos][1]+".cdx",Lower(aIndex[pos][2][i][2]))
endif
self:oDCProgressBar2:Advance(1)
next i
else
oserver:close()
return false
endif
oserver:close()
endif
return true
METHOD CreateCDXProg() CLASS W_INDEXING
ApplicationExec(EXECWHILEEVENT) // rgtr 090508
self:oDCProgressBar1:Advance(1)
self:oDCMultiLineEdit1:value += crlf + " Advance 1"
RETURN nil
But the function CreateCDX is only called once a time during the
createOrder, and my code create the order, but don't index the file at all.
My windows says :
Processing Order 1 - CLIENT
Processing Order 2 - CLIENT_NU
Advance 1
Processing Order 3 - CLIENT_TV
Advance 1
Processing Order 4 - CLIENT_NV
Advance 1
Processing Order 5 - CLIENT_MA
Advance 1
If i remove the SetOrderCondition part, everything works pretty well but the
windows freeze during the indexing of big files.
I wanted the CreateCDXProg function to be called each time a record (or
maybe 100 records) is processed to leave the hand to the user and have the
index done!
Any advice would be welcome!
Philippe
[toc] | [prev] | [next] | [standalone]
| From | "Philippe Bayard (Belgium)" <philbayard@gmail.com> |
|---|---|
| Date | 2013-03-27 09:03 -0700 |
| Message-ID | <d0587e87-0895-4649-bc39-0004683d162f@googlegroups.com> |
| In reply to | #4976 |
Thanks, that was exactly the problem.
Everything works well now.
Thank you both!
Le mercredi 27 mars 2013 16:28:16 UTC+1, Jamal a écrit :
> Hi Philippe,
>
>
>
> CreateCDXProg() return value must be a logical value, try setting it to TRUE
>
> not NIL.
>
>
>
> HTH,
>
> Jamal
>
>
>
> "Philippe Bayard (Belgium)" wrote in message
>
> news:5e5d3496-72c8-4b80-af4f-82122341f5ab@googlegroups.com...
>
>
>
> Hi everyone,
>
>
>
> I'm trying to do as many people did on this newsgroup : Some index with a
>
> progress bar.
>
>
>
> But i can't make it works.
>
>
>
> I'm doing this :
>
>
>
> METHOD CreateIndex(FileName) CLASS W_INDEXING
>
>
>
> LOCAL aIndex := {} as ARRAY
>
> LOCAL pos as DWORD
>
> LOCAL i as DWORD
>
> LOCAL oserver as DbServer
>
> LOCAL lSuccess as LOGIC
>
> LOCAL Max as DWORD
>
> LOCAl oself as OBJECT
>
>
>
> LOCAL cFor as STRING
>
> LOCAL lAll, lRest, lDescend as LOGIC
>
> LOCAL cbForCondition, cbWhileCondition, cbEval as USUAL
>
> LOCAL nStep, nStart, nNext, nRecord as SHORTINT
>
>
>
>
>
> // For condition string format
>
> cFor := null_string
>
> // Actual for condition
>
> cbForCondition := nil
>
> lAll := true
>
> cbWhileCondition := {|| true} // While all
>
> oself := self
>
> cbEval := {||oself:CreateCDXProg()} // Indexing code
>
>
>
>
>
> // block
>
> nStep := 0 // Step through all
>
> nStart := 0 // From top
>
> nNext := 0 // All
>
> nRecord := 0 // All records
>
> lRest := FALSE // ALL
>
> lDescend := FALSE // Ascending
>
>
>
>
>
> aIndex := CreateIndexList()
>
> pos := AScan(aIndex,{|aVal| aVal[1] = FileName} )
>
> if pos > 0
>
> oserver:=
>
> DbServer{oEnvObject:cPath+FileName+".dbf",DBEXCLUSIVE}
>
> Max := oserver:Count()
>
> oserver:gotop()
>
>
>
> if oserver:used
>
> FOR i:=1 to oserver:OrderInfo(DBOI_ORDERCOUNT)
>
> oserver:DeleteOrder(i,null_string)
>
> NEXT i
>
> self:oDCProgressBar2:Range := Range{ 1
>
> ,ALen(aIndex[pos][2]) }
>
> self:Show()
>
> for i:=1 to ALen(aIndex[pos][2])
>
> self:oDCMultiLineEdit1:TextValue += crlf +
>
> "Processing Order "+ AsString(i) + " - " +aIndex[pos][2][i][1]
>
> if i==1
>
> self:oDCProgressBar1:Range :=
>
> Range{ 1, Max }
>
> self:oDCMaxRecord:value := Max
>
> ApplicationExec(1)
>
> lSuccess:= oserver:CreateIndex(
>
> aIndex[pos][1]+".cdx",aIndex[pos][2][i][2])
>
> else
>
> self:oDCProgressBar1:Range :=
>
> Range{ 1, Max }
>
> self:oDCMaxRecord:value := Max
>
> ApplicationExec(1)
>
> //lSuccess:=
>
> oserver:SetOrderCondition(null_string, null_string , , ,
>
> {||oself:CreateCDXProg()},0)
>
> RddSetDefault("DBFCDX")
>
> oserver:SetOrderCondition(cFor,
>
> cbForCondition, lAll,cbWhileCondition, cbEval,nStep, nStart, nNext, nRecord,
>
> lRest, lDescend)
>
> lSuccess:= oserver:createorder(
>
> Lower(aIndex[pos][2][i][1]),oEnvObject:cPath+aIndex[pos][1]+".cdx",Lower(aIndex[pos][2][i][2]))
>
> endif
>
> self:oDCProgressBar2:Advance(1)
>
> next i
>
> else
>
> oserver:close()
>
> return false
>
> endif
>
> oserver:close()
>
> endif
>
>
>
> return true
>
>
>
> METHOD CreateCDXProg() CLASS W_INDEXING
>
>
>
> ApplicationExec(EXECWHILEEVENT) // rgtr 090508
>
> self:oDCProgressBar1:Advance(1)
>
> self:oDCMultiLineEdit1:value += crlf + " Advance 1"
>
> RETURN nil
>
>
>
>
>
> But the function CreateCDX is only called once a time during the
>
> createOrder, and my code create the order, but don't index the file at all.
>
>
>
> My windows says :
>
>
>
> Processing Order 1 - CLIENT
>
> Processing Order 2 - CLIENT_NU
>
> Advance 1
>
> Processing Order 3 - CLIENT_TV
>
> Advance 1
>
> Processing Order 4 - CLIENT_NV
>
> Advance 1
>
> Processing Order 5 - CLIENT_MA
>
> Advance 1
>
>
>
> If i remove the SetOrderCondition part, everything works pretty well but the
>
> windows freeze during the indexing of big files.
>
>
>
> I wanted the CreateCDXProg function to be called each time a record (or
>
> maybe 100 records) is processed to leave the hand to the user and have the
>
> index done!
>
>
>
> Any advice would be welcome!
>
>
>
> Philippe
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web