newsgroups-index (beta)

Current group: dbase.programming

how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form

how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form  
Jos Moeskops
 Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form  
Roland Wingerter
 Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form  
Jos Moeskops
 Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form  
Roland Wingerter
 Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form  
Roland Wingerter
 database engine error: corrupt/blob file with cSearch $ etc.  
Jos Moeskops
 Re: database engine error: corrupt/blob file with cSearch $ etc.  
Roland Wingerter
 Re: database engine error: corrupt/blob file with cSearch $ etc.  
Jos Moeskops
From:Jos Moeskops
Subject:how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form
Date:Sun, 16 Jan 2005 14:32:15 -0500
function ENTRYFIELD3_onChange
SET EXACT OFF
cName = trim( upper( form.entryfield3.value ) )
cName = trim( cName )
form.emaildivdatamodule1.emaildiv1.rowset.applyLocate(" name = '" +cName + "'" )
return

this works good
but how to use this applyLocate with -"cName" $ upper( name )-

and further with the next record

Thanks for your replay, Jos Moeskops
From:Roland Wingerter
Subject:Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form
Date:Sun, 16 Jan 2005 23:06:39 +0100
Jos Moeskops wrote:
> function ENTRYFIELD3_onChange
> SET EXACT OFF
> cName = trim( upper( form.entryfield3.value ) )
> cName = trim( cName )
> form.emaildivdatamodule1.emaildiv1.rowset.applyLocate(" name =
> '" +cName + "'" ) return
>
> this works good
> but how to use this applyLocate with -"cName" $ upper( name )-
------
You cannot use the $ operator with applyLocate(). But you could write your
own code, like in the following sample.

function ENTRYFIELD3_onChange
local cSearch
if not empty(this.value)
cSearch = upper(trim(this.value))
do while not form.rowset.endOfSet
if not cSearch $ upper(form.rowset.fields["name"].value)
form.rowset.next()
else
exit
endif
enddo
endif
return

Could be improved, but I think you get the idea.

BTW, SET EXACT ON|OFF is old dbase syntax and has no effect on the way
applyLocate() works. Check out rowset.locateOptions in the online help.

Roland
From:Jos Moeskops
Subject:Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form
Date:Mon, 17 Jan 2005 06:34:48 -0500
Hello Roland, thanks, this works good.

But how can i looking forward and backwards. For example the next or previeus rowset where somewhere in the name is 'mith' , 'MITH' , 'mITh' or whatever.

Thanks again and regards Jos Moeskops

Roland Wingerter Wrote:

> Jos Moeskops wrote:
> > function ENTRYFIELD3_onChange
> > SET EXACT OFF
> > cName = trim( upper( form.entryfield3.value ) )
> > cName = trim( cName )
> > form.emaildivdatamodule1.emaildiv1.rowset.applyLocate(" name =
> > '" +cName + "'" ) return
> >
> > this works good
> > but how to use this applyLocate with -"cName" $ upper( name )-
> ------
> You cannot use the $ operator with applyLocate(). But you could write your
> own code, like in the following sample.
>
> function ENTRYFIELD3_onChange
> local cSearch
> if not empty(this.value)
> cSearch = upper(trim(this.value))
> do while not form.rowset.endOfSet
> if not cSearch $ upper(form.rowset.fields["name"].value)
> form.rowset.next()
> else
> exit
> endif
> enddo
> endif
> return
>
> Could be improved, but I think you get the idea.
>
> BTW, SET EXACT ON|OFF is old dbase syntax and has no effect on the way
> applyLocate() works. Check out rowset.locateOptions in the online help.
>
> Roland
>
>
>
>
>
From:Roland Wingerter
Subject:Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form
Date:Mon, 17 Jan 2005 13:44:16 +0100
Jos Moeskops wrote:
> Hello Roland, thanks, this works good.
>
> But how can i looking forward and backwards. For example the next or
> previeus rowset where somewhere in the name is 'mith' , 'MITH' ,
> 'mITh' or whatever.
------
That's what I meant when I said it could be improved. ;-)

Suppose you put two radiobuttons on the form, radio_up and radio_down. Their
current value determines wether we have to search forwards or backwards.
This could be done as shown in the sample below.

It seems to work, but I did not do a lot of testing.

Roland


** END HEADER -- do not remove this line
//
// Generated on 17.01.2005
//
parameter bModal
local f
f = new fishfindForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class fishfindForm of FORM
with (this)
height = 19.8636
left = 21.8571
top = 5.1364
width = 71.0
text = ""
endwith

this.DBASESAMPLES1 = new DATABASE()
this.DBASESAMPLES1.parent = this
with (this.DBASESAMPLES1)
left = 50.0
top = 17.5
databaseName = "dbasesamples"
active = true
endwith

this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 44.0
top = 17.5
database = form.dbasesamples1
sql = "select * from fish.dbf"
active = true
endwith

this.LABELFIND = new TEXTLABEL(this)
with (this.LABELFIND)
height = 1.0
left = 3.0
top = 1.0
width = 6.0
text = "Find:"
alignVertical = 1 // Middle
alignHorizontal = 2 // Right
endwith

this.EF_FIND = new ENTRYFIELD(this)
with (this.EF_FIND)
onChange = class::EF_FIND_ONCHANGE
height = 1.0
left = 10.0
top = 1.0
width = 27.0
value = ""
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.fish1.rowset
rowSelect = true
height = 12.0
left = 2.0
top = 4.0
width = 61.0
endwith

this.PB_FIND = new PUSHBUTTON(this)
with (this.PB_FIND)
onClick = {; class::findNext()}
height = 1.0909
left = 37.0
top = 1.0
width = 12.0
text = "&Find Next"
endwith

this.RADIO_UP = new RADIOBUTTON(this)
with (this.RADIO_UP)
height = 1.0909
left = 51.0
top = 1.0
width = 6.0
text = "&Up"
group = true
endwith

this.RADIO_DOWN = new RADIOBUTTON(this)
with (this.RADIO_DOWN)
height = 1.0909
left = 59.0
top = 1.0
width = 15.7143
text = "&Down"
value = true
endwith

this.rowset = this.fish1.rowset

function EF_FIND_onChange
class::findNext()
return

function findNext
local cSearch, lFound
lFound = false

if not empty(form.ef_find.value)
// Get value to search
cSearch = upper(trim(form.ef_find.value))

// Get search direction
nSkip = iif(form.radio_down.value = true, +1, -1)

// We want to find the *next* matching record,
// Skip current record if it is a match
if cSearch $ upper(form.rowset.fields["name"].value)
form.rowset.next(nSkip)
endif

// Loop through the rowset
do while not form.rowset.endOfSet
if not cSearch $ upper(form.rowset.fields["name"].value)
form.rowset.next(nSkip)
else
lFound = true
exit
endif
enddo

if lFound = false
if nSkip = +1 // we are at the end
cQuestion = "End of rowset. Continue from top?"
else
cQuestion = "Top of rowset. Continue from bottom?"
endif
if msgbox( cQuestion, "Information", 4 ) == 6 // yes, continue
if nSkip = +1
form.rowset.first()
else
form.rowset.last()
endif
class::findNext()
endif
endif
endif

return

endclass
From:Roland Wingerter
Subject:Re: how to use (loca for) "variabele" $ upper( name ) in applyLocate in a form
Date:Mon, 17 Jan 2005 13:56:19 +0100
Roland Wingerter wrote:
> It seems to work, but I did not do a lot of testing.
-----
Fixed bug when search is continued after endOfSet.

Roland


** END HEADER -- do not remove this line
//
// Generated on 17.01.2005
//
parameter bModal
local f
f = new fishfindForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class fishfindForm of FORM
with (this)
height = 19.8636
left = 21.8571
top = 5.1364
width = 71.0
text = ""
endwith

this.DBASESAMPLES1 = new DATABASE()
this.DBASESAMPLES1.parent = this
with (this.DBASESAMPLES1)
left = 50.0
top = 17.5
databaseName = "dbasesamples"
active = true
endwith

this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 44.0
top = 17.5
database = form.dbasesamples1
sql = "select * from fish.dbf"
active = true
endwith

this.LABELFIND = new TEXTLABEL(this)
with (this.LABELFIND)
height = 1.0
left = 3.0
top = 1.0
width = 6.0
text = "Find:"
alignVertical = 1 // Middle
alignHorizontal = 2 // Right
endwith

this.EF_FIND = new ENTRYFIELD(this)
with (this.EF_FIND)
onChange = class::EF_FIND_ONCHANGE
height = 1.0
left = 10.0
top = 1.0
width = 27.0
value = ""
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.fish1.rowset
rowSelect = true
height = 12.0
left = 2.0
top = 4.0
width = 61.0
endwith

this.PB_FIND = new PUSHBUTTON(this)
with (this.PB_FIND)
onClick = {; class::findNext()}
height = 1.0909
left = 37.0
top = 1.0
width = 12.0
text = "&Find Next"
endwith

this.RADIO_UP = new RADIOBUTTON(this)
with (this.RADIO_UP)
height = 1.0909
left = 51.0
top = 1.0
width = 6.0
text = "&Up"
group = true
endwith

this.RADIO_DOWN = new RADIOBUTTON(this)
with (this.RADIO_DOWN)
height = 1.0909
left = 59.0
top = 1.0
width = 15.7143
text = "&Down"
value = true
endwith

this.rowset = this.fish1.rowset

function EF_FIND_onChange
class::findNext()
return

function findNext
parameter lNewSearch

if argCount() = 0
lNewSearch = true
endif

local cSearch, lFound
lFound = false

if not empty(form.ef_find.value)
// Get value to search
cSearch = upper(trim(form.ef_find.value))

// Get search direction
nSkip = iif(form.radio_down.value = true, +1, -1)

// We want to find the *next* matching record.
// So if we are doing a new search (not continued from endOfSet)
// we skip current record if it is a match.
if lNewSearch and cSearch $ upper(form.rowset.fields["name"].value)
form.rowset.next(nSkip)
endif

// Loop through the rowset
do while not form.rowset.endOfSet
if not cSearch $ upper(form.rowset.fields["name"].value)
form.rowset.next(nSkip)
else
lFound = true
exit
endif
enddo

if lFound = false
if nSkip = +1 // we are at the end
cQuestion = "End of rowset. Continue from top?"
else
cQuestion = "Top of rowset. Continue from bottom?"
endif
if msgbox( cQuestion, "Information", 4 ) == 6 // yes, continue
if nSkip = +1
form.rowset.first()
else
form.rowset.last()
endif
class::findNext(false)
endif
endif
endif

return

endclass
From:Jos Moeskops
Subject:database engine error: corrupt/blob file with cSearch $ etc.
Date:Tue, 18 Jan 2005 05:21:38 -0500
Hello, i get a
- database engine error: corrupt/blob file -
when using the commands see below
and when i several time ignor he finds the next record

function ENTRYFIELD6_onChange
local cSearch
if not empty(this.value)
cSearch = lower(trim(this.value))
do while not form.rowset.endOfSet
if not cSearch $ lower (form.emaildivdatamodule1.emaildiv1.rowset.fields["naam"].value)
form.rowset.next()
else
exit
endif
enddo
endif

return

function PUSHBUTTON1_onClick1

local cSearch
form.rowset.next(-1)
cSearch = lower(trim(form.ENTRYFIELD6.value))
do while not form.rowset.endOfSet
if not cSearch $ lower(form.emaildivdatamodule1.emaildiv1.rowset.fields["naam"].value)
form.rowset.next(-1)
else
exit
endif
enddo

return

function PUSHBUTTON4_onClick

local cSearch
form.rowset.next(+1)
cSearch = lower(trim(form.ENTRYFIELD6.value))
do while not form.rowset.endOfSet
if not cSearch $ lower(form.emaildivdatamodule1.emaildiv1.rowset.fields["naam"].value)
form.rowset.next(+1)
else
exit
endif
enddo

return
From:Roland Wingerter
Subject:Re: database engine error: corrupt/blob file with cSearch $ etc.
Date:Tue, 18 Jan 2005 12:20:09 +0100
Jos Moeskops wrote:
> Hello, i get a
> - database engine error: corrupt/blob file -
> when using the commands see below
> and when i several time ignor he finds the next record
------
Looks like your table has one or more corrupt memo fields.

This message by Jim Sare has instructions what to do (watch line wrap):

>
http://64.132.211.166/App/FmtNws.dbw?NwsFile=f%3A%5Ccorpusnws%5Cen%5Cversion
5%5C23651%2Enws&Subject=Re%3A+memo+file+corruption

IIRC there is no repair program for fixing corrupt level 7 tables, but the
manual method should work. If you don't succeed, ask for help in a new
thread.

Roland
From:Jos Moeskops
Subject:Re: database engine error: corrupt/blob file with cSearch $ etc.
Date:Tue, 18 Jan 2005 07:53:12 -0500
Roland, thanks a lot.
I've repaired my dbf and everyting works very good, i can start with my work now.

Regards Jos Moeskops

Roland Wingerter Wrote:

> Jos Moeskops wrote:
> > Hello, i get a
> > - database engine error: corrupt/blob file -
> > when using the commands see below
> > and when i several time ignor he finds the next record
> ------
> Looks like your table has one or more corrupt memo fields.
>
> This message by Jim Sare has instructions what to do (watch line wrap):
>
> >
> http://64.132.211.166/App/FmtNws.dbw?NwsFile=f%3A%5Ccorpusnws%5Cen%5Cversion
> 5%5C23651%2Enws&Subject=Re%3A+memo+file+corruption
>
> IIRC there is no repair program for fixing corrupt level 7 tables, but the
> manual method should work. If you don't succeed, ask for help in a new
> thread.
>
> Roland
>
>
   

Copyright © 2006 newsgroups-index   -   All rights reserved   -   Impressum