| Author |
record # of rowset.count()
|
|
| john noble 2005-04-18, 7:23 am |
| Underneath my grid I would like to insert a label that shows which record is currently selected. ie 5 / 100. where 5th record is selected out of 100.
I thought that capturing the rowsets position into .bookmark and then displaying the value of .bookmark would work but I cant get it to.
Can anyone advise on this matter?
Johhn
| |
|
| See rowNo( ) and rowcount() in OLH - bookmark is not a number it can be used
with goto() but not desplayed, as far as I know.
Peter
"john noble" <john@nor-tech.co.uk> wrote in message
news:BtB$6O$QFHA.432@news-server...
> Underneath my grid I would like to insert a label that shows which record
> is currently selected. ie 5 / 100. where 5th record is selected out of
> 100.
>
> I thought that capturing the rowsets position into .bookmark and then
> displaying the value of .bookmark would work but I cant get it to.
>
> Can anyone advise on this matter?
>
> Johhn
| |
| Ken Mayer [dBVIPS] 2005-04-18, 7:23 am |
| john noble wrote:
> Underneath my grid I would like to insert a label that shows which
> record is currently selected. ie 5 / 100. where 5th record is
> selected out of 100.
>
> I thought that capturing the rowsets position into .bookmark and then
> displaying the value of .bookmark would work but I cant get it to.
>
> Can anyone advise on this matter?
The bookmark() method of the rowset returns a value that is meaningless
to anything but the rowset object's goto() method. OODML does not
understand logical record numbers. If you want to do what you're talking
about, you're going to have to do a ton of extra processing ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
|
| Another way is to have an AutoIncrement field in the table, but this is
rather limiting as it won't work with filters,indexes etc.
Peter
"john noble" <john@nor-tech.co.uk> wrote in message
news:BtB$6O$QFHA.432@news-server...
> Underneath my grid I would like to insert a label that shows which record
> is currently selected. ie 5 / 100. where 5th record is selected out of
> 100.
>
> I thought that capturing the rowsets position into .bookmark and then
> displaying the value of .bookmark would work but I cant get it to.
>
> Can anyone advise on this matter?
>
> Johhn
| |
| john noble 2005-04-18, 11:23 am |
| Ken Mayer [dBVIPS] Wrote:
> If you want to do what you're talking
> about, you're going to have to do a ton of extra processing ...
>
> Ken
>
Thats a pity, particularly when the grid seems to already store similar info to that what I am looking for.
ie the speed tip that displays the row number of the current top row on grid. Thats really what Im looking for - but for the 'selected' row instead.
Thanks Guys,
John
| |
| Michael Nuwer [dBVIPS] 2005-04-18, 11:23 am |
| john noble wrote:
> Ken Mayer [dBVIPS] Wrote:
>
>
>
> Thats a pity, particularly when the grid seems to already store similar info to that what I am looking for.
>
> ie the speed tip that displays the row number of the current top row on grid. Thats really what Im looking for - but for the 'selected' row instead.
Maybe the example below will help. Also see this article:
http://www.nuwermj.potsdam.edu/dBulletin/bu16_d.htm
** END HEADER -- do not remove this line
//
// Generated on 04/18/2005
//
parameter bModal
local f
f = new DemoForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class DemoForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 16.0
left = 40.7143
top = 3.3636
width = 40.0
text = ""
endwith
this.DBASESAMPLES1 = new DATABASE()
this.DBASESAMPLES1.parent = this
with (this.DBASESAMPLES1)
left = 24.0
top = 10.0
databaseName = "DBASESAMPLES"
active = true
endwith
this.FISH2 = new QUERY()
this.FISH2.parent = this
with (this.FISH2)
left = 32.0
top = 12.5
database = form.dbasesamples1
sql = "select * from fish.dbf"
active = true
endwith
with (this.FISH2.rowset)
indexName = "NAME"
endwith
this.FISH1 = new QUERY()
this.FISH1.parent = this
with (this.FISH1)
left = 24.0
top = 12.5
database = form.dbasesamples1
sql = "select * from fish.dbf"
active = true
endwith
with (this.FISH1.rowset)
onNavigate = class::ROWSET_onNAVI
GATE
indexName = "NAME"
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.fish1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
columns["COLUMN1"].dataLink = form.fish1.rowset.fields["name"]
columns["COLUMN1"].editorType = 1 // EntryField
columns["COLUMN1"].width = 42.8571
with (columns["COLUMN1"].headingControl)
value = "Name"
endwith
height = 9.0
left = 1.0
top = 0.5
width = 34.0
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 1.0
left = 6.0
top = 10.5
width = 16.0
text = "Text1"
endwith
this.rowset = this.fish1.rowset
function form_onOpen
form.rowset.first()
return
function rowset_onNavigate
local nCurrentRow, nMaxRows, rs2
rs2 = this.parent.parent.fish2.rowset
rs2.first()
cFirst = rs2.fields['Name'].value
rs2.setRange( cFirst, this.fields['name'].value)
nCurrentRow = rs2.count()
nMaxRows = this.count()
this.parent.parent.text1.text = ""+ nCurrentRow + " of " + ;
nMaxRows
return true
endclass
| |
| Peter 2005-04-18, 11:23 am |
| This works if there is no index on the rowset:
form.GRID1 = new GRID(form)
with (form.GRID1)
onSelChange = {;form.text1.text = this.datalink.rowno() + "/" +
this.datalink.rowcount()}
you could do some fancy formatting and disable if values = -1 (when an index
is active)
Peter
"john noble" <john@nor-tech.co.uk> wrote in message
news:oPO7xlCRFHA.320@news-server...
> Ken Mayer [dBVIPS] Wrote:
>
> Thats a pity, particularly when the grid seems to already store similar
> info to that what I am looking for.
>
> ie the speed tip that displays the row number of the current top row on
> grid. Thats really what Im looking for - but for the 'selected' row
> instead.
>
> Thanks Guys,
>
> John
| |
| Ken Mayer [dBVIPS] 2005-04-18, 11:23 am |
| john noble wrote:
> Ken Mayer [dBVIPS] Wrote:
>
>
>
> Thats a pity, particularly when the grid seems to already store
> similar info to that what I am looking for.
>
> ie the speed tip that displays the row number of the current top row
> on grid. Thats really what Im looking for - but for the 'selected'
> row instead.
That only works if the rowset is not indexed.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Heinz Kesting 2005-04-18, 8:23 pm |
| Hi John
> Thats a pity, particularly when the grid seems to already store similar
info to that what I am looking for.
>
> ie the speed tip that displays the row number of the current top row on
grid. Thats really what Im looking for - but for the 'selected' row instead.
I did a thing like this with an extra numeric field, containing the number
of the row. Problem is then to keep this number up to date when new rows are
added or others are deleted. In these cases you would have to go through all
the rows for re-numbering ... if it's about bigger amounts of data, this
won't be practicable.
Please ask if you'd like to see a code sample.
Kind regards, Heinz
| |
| Rick Gearardo 2005-04-18, 8:23 pm |
| Take a look at this and see if it works for you.
test1 and test2 are both rowsets using the same dbf, test2 has no indexName
set.
form.rowset = form.test1.rowset
func open()
form.init()
return super::OPEN()
proc init
form.rowset.indexName := "test"
form.rowset.onNavigate := {;this.parent.parent.onNav()}
form.onNav()
proc onNav
local q1, q2, fnd, i, j
q1 = form.rowset
q2 = form.test2.rowset
fnd = false
i = 1
q2.first()
do while .not. q2.endOfSet .and. .not. fnd
if q1.fields["test"].value == q2.fields["test"].value
fnd = true
else
i++
q2.next()
endif
enddo
j = i - 1
do while .not. q2.endOfSet
j++
q2.next()
enddo
if fnd
form.textlabel1.text := ltrim(trim(str(i))) + " of " +
trim(ltrim(str(j)))
endif
Rick
> Underneath my grid I would like to insert a label that shows which record
> is currently selected. ie 5 / 100. where 5th record is selected out of
> 100.
| |
| Ken Mayer [dBVIPS] 2005-04-18, 8:23 pm |
| Heinz Kesting wrote:
> Hi John
>
>
>
> info to that what I am looking for.
>
>
> grid. Thats really what Im looking for - but for the 'selected' row instead.
>
> I did a thing like this with an extra numeric field, containing the number
> of the row. Problem is then to keep this number up to date when new rows are
> added or others are deleted. In these cases you would have to go through all
> the rows for re-numbering ... if it's about bigger amounts of data, this
> won't be practicable.
Or the sort sequence changes ... <g>
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
|
|
|
|