xBrowse with SQLRDD
xBrowse with SQLRDD
Hi to all,
Anyone can put a sample with xBrowse with SQLRDD.
If it's posible, define only two fields of file with many fields.
Thank you.
Pere Cordonet
Anyone can put a sample with xBrowse with SQLRDD.
If it's posible, define only two fields of file with many fields.
Thank you.
Pere Cordonet
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse with SQLRDD
>>
If it's posible, define only two fields of file with many fields.
>>
Yes.
@ .. XBROWSE ......
COLUMNS "field1name", "field2name" ;
<other clauses>
I have not used SQLRDD. But I have gone through the manual quickly. It appears SQLRDD does not support OrdKeyCount() and OrdKeyNo(). I am not sure if I am right. There could be some issues with SQLRDD.
If it's posible, define only two fields of file with many fields.
>>
Yes.
@ .. XBROWSE ......
COLUMNS "field1name", "field2name" ;
<other clauses>
I have not used SQLRDD. But I have gone through the manual quickly. It appears SQLRDD does not support OrdKeyCount() and OrdKeyNo(). I am not sure if I am right. There could be some issues with SQLRDD.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse with SQLRDD
I use xBrowse with SQLRDD and can confirm that it works - there are issues with OrdKeyCount() & OrdKeyNo() as nageswaragunupudi says - the only area i have found to be a problem is the "hot key" seeking in a browse.
Regards,
Pete
Regards,
Pete
Re: xBrowse with SQLRDD
Thank you, for your answer.
I'll try substitute these functions !
Pere Cordonet
I'll try substitute these functions !
Pere Cordonet
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse with SQLRDD
If this is the case, I would suggest that after creating xbrowse, we need to override these codeblocks:PeterHarmes wrote:I use xBrowse with SQLRDD and can confirm that it works - there are issues with OrdKeyCount() & OrdKeyNo() as nageswaragunupudi says - the only area i have found to be a problem is the "hot key" seeking in a browse.
Regards,
Pete
oBrw:bKeyNo := { |n| If( n == nil, (oBrw:cAlias)->( RecNo() ), (oBrw:cAlias)->(DbGoTo(n)) }
oBrw:bKeyCount := { || (oBrw:cAlias)->( LastRec() ) }
Better to retain the other default codeblocks as created by xbrowse without disturbing them.
I presume RecNo(), DbGoTo(n) and LastRec() are supported. If they have other names, they can be substituted.
Still there could be occasional issues because in SQLRDD, the recno can be higher than the recordcount.
May I know how DbSeek() works or how we can simulate that behavior?
( Xbrowse implements incremental seek for ADO recordsets using ADO Find method)
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse with SQLRDD
Recno() & Dbgoto exist and work in the normal way - i'm not too sure about Lastrec() as i don't use it - i will do some tests tomorrow to see if this works.
Dbseek() also works in the same way (although the softseek parameter seems a bit buggy)
Dbseek() also works in the same way (although the softseek parameter seems a bit buggy)
Re: xBrowse with SQLRDD
I need some time for implement this source.
When i have a result, i'll comment this.
Thank you.
Pere Cordoent
When i have a result, i'll comment this.
Thank you.
Pere Cordoent
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse with SQLRDD
Tests on Lastrec
Opened orders table - has 7621 rows
Lastrec() returns 7628 which is the largest value in the column sr_recno (where the record number/row number) is stored.
In the xHarbour Reference - Lastrec() should return the number of records, so I would say this function does not work properly under SQLRDD
Pete
Opened orders table - has 7621 rows
Lastrec() returns 7628 which is the largest value in the column sr_recno (where the record number/row number) is stored.
In the xHarbour Reference - Lastrec() should return the number of records, so I would say this function does not work properly under SQLRDD
Pete
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse with SQLRDD
Mr. Peter Harmes,
I understand.
For xbrowse to properly work,
1) oBrw:bKeyCount should be a codeblock which should return the total number of rows.
So what function do you advise for this codeblock?
2) oBrw:bKeyNo := { |n| If( n == nil, < serial number of the row >, < goto the n'th row from top> ) }
For bKeyNo codeblock, what functions do you advise?
I understand.
For xbrowse to properly work,
1) oBrw:bKeyCount should be a codeblock which should return the total number of rows.
So what function do you advise for this codeblock?
2) oBrw:bKeyNo := { |n| If( n == nil, < serial number of the row >, < goto the n'th row from top> ) }
For bKeyNo codeblock, what functions do you advise?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse with SQLRDD
What I understood from what little i read the documentation is this. SR_RecNo is maintained like an autoincrement number. When no records are deleted, and no filters or scopes are set ( using where clause or otherwise ) Max( SR_RecNo) -->LastRec() correctly represents the total rows. But when some records are deleted, number of rows is less than LastRec,i.e. Max(SR_RecNo). And most of the times we read and browse only a subset of the total table using some kind of scope or filter or where clause.Opened orders table - has 7621 rows
Lastrec() returns 7628 which is the largest value in the column sr_recno (where the record number/row number) is stored.
In such cases we need to have reliable way to know (i) number of rows, (ii) serial number of the row and (iii) to go to a row with a given serial number in the subset being browsed.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: xBrowse with SQLRDD
A very slow elementary functions could be:
Require that if the procedure would be correct.
Thank you.
Pere Cordonet
Code: Select all
Function SR_OrdkeyCount(xOrder)
Local nItem:= 0, nRecno:= Recno()
Local nOO:= OrdNumber()
OrdSetFocus( xOrder )
DbGotop()
DbEval({|| nItem++ })
OrdSetFocus(nOO)
DbGoto(nRecno)
Return nItem
Code: Select all
Function SR_OrdkeyNo(xOrder)
Local nItem:= 0, nRecno:= Recno(),nKey:= 0
Local nOO:= OrdNumber()
OrdSetFocus( xOrder )
DbGotop()
DbEval({|| nItem++,Iif(Recno() == nRecno, nKey:= nItem,nil) },,{|| Empty(nKey) } )
Iif(Empty(nKey),nKey:= nItem,nil)
OrdSetFocus(nOO)
DbGoto(nRecno)
Return nKey
Thank you.
Pere Cordonet
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: xBrowse with SQLRDD
You can download this sample: http://www.despachoarteaga.com.mx/VisorSQL.zip
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: xBrowse with SQLRDD
Mr. Peter Harmes
If you are using xBrowse with SQLRDD successfully, can you please tell us how are you building codeblocks for oBrw:bKeyNo and oBrw:bKeyCount ?
From what I understand from the above postings, I think the codeblocks I posted earlier should give reasonable results for browsing full tables and where there are no or few deleted records.
In other cases, I think of an alternative approach, which takes some setup time but xBrowse will work correctly.
If you are using xBrowse with SQLRDD successfully, can you please tell us how are you building codeblocks for oBrw:bKeyNo and oBrw:bKeyCount ?
From what I understand from the above postings, I think the codeblocks I posted earlier should give reasonable results for browsing full tables and where there are no or few deleted records.
In other cases, I think of an alternative approach, which takes some setup time but xBrowse will work correctly.
Code: Select all
// Initially
aRows := {}
(cAlias)->( DbGoTop() )
(cAlias)->( DbEval( {|| AAdd( aRows, RecNo() ) } )
(cAlias)->( DbGoTop() )
// normal xbrowse code
@ <r>, <c> XBROWSE oBrw COLUMNS .....<other clauses> ..;
ALIAS cAlias ROWS aRows // Please note the clause ROWS aRows
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: xBrowse with SQLRDD
I have finally changed bKeyCount and bKeyno codeblock
It works quite well (with a table with 200 entries)
Thanks for all information to finally works fine, not is the best solution for a long tables, but this function will be much better if xharbour will be written in sqlrdd lib.
Thanks to all
Pere Cordonet
Note: Sorry for my english, it's very poor.
It works quite well (with a table with 200 entries)
Code: Select all
@ <r>, <c> XBROWSE oBrw
oBrw:SetRDD (. f.. f.)
oBrw:bKeyNo := {|| ( ::cAlias )->( SR_OrdkeyNo() ) }
oBrw:bKeyCount := {|| ( ::cAlias )->( SR_OrdkeyCount() ) }
Thanks to all
Pere Cordonet
Note: Sorry for my english, it's very poor.
-
- Posts: 363
- Joined: Wed Feb 15, 2006 2:06 pm
- Location: Oxford, England
Re: xBrowse with SQLRDD
I dont build a code block for bKeyno, but for bKeycount (where i use it) - i do a SQL count for the number of records that meet the criteria and apply this to a variable and to bKeycount.
By the looks of things on the data we have used, the standard xBrowse functionality works fine!!
By the looks of things on the data we have used, the standard xBrowse functionality works fine!!