FWH: MySql/MariaDB: RowSet object

Re: FWH: MySql/MariaDB: RowSet object

Postby luiz53 » Thu May 18, 2017 1:23 pm

CHANGE LINE 35 TO
Code: Select all  Expand view

   oRs:bOnChangePage = { || vsay := alltrim(STR(oRs:nCurrentPage))+" / "+alltrim( STR(oRs:nMaxPages)),;
                            oSay:refresh(),oBrw:Refresh() }
 
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: FWH: MySql/MariaDB: RowSet object

Postby luiz53 » Mon May 22, 2017 6:47 pm

MR Rao...

OLD - Don´t work key down or key UP
Code: Select all  Expand view

oRs:lAutoPage     := .t.
 


NEW - BUT don´t work oRs:bOnChangePage with key down or key UP
Code: Select all  Expand view

oRs:lAutoExpand   := .t.
 


https://www.youtube.com/watch?v=DgP54iw ... e=youtu.be
luiz53
 
Posts: 43
Joined: Fri Jun 01, 2007 12:41 pm

Re: FWH: MySql/MariaDB: RowSet object

Postby nageswaragunupudi » Tue May 23, 2017 12:28 am

In your dolphin example also pressing down arrow key does not go to next page. I sent you a sample which works exactly like your sample.
Note: Personally I do not like this kind of paging.

I prefer this
viewtopic.php?f=3&t=33830&p=199916&hilit=million#p199916
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH: MySql/MariaDB: RowSet object

Postby nageswaragunupudi » Mon Jul 09, 2018 5:51 am

Dynamically changing fields, [table], [connection] of a Rowset at runtime and also change the XBrowse:

This is possible from FWH 18.05:
Code: Select all  Expand view

oRs := oCn:RowSet( cSql )
// set up browse
// during runtime
//

oRs:oCn := oNewCn // Optional
oRs:ReQuery( cNewSql ) // same or different table
oRs:SetXbrColumns( oBrw )
 


Sample:
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oCn, oRs, oDlg, oBrw
   local aSql  := {  "select id,first,city, salary from customer", ;
                     "select * from states", ;
                     "select * from annual" }

   oCn   := FW_DemoDB()
   oRs   := oCn:RowSet( aSql[ 1 ] )

   DEFINE DIALOG oDlg SIZE 600,400 PIXEL TRUEPIXEL ;
      TITLE "SWITCH TABLES/FIELDS AT RUNTIME"

   @ 60, 20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS CELL LINES NOBORDER
   oBrw:CreateFromCode()

   @ 20, 20 BTNBMP PROMPT "CUSTOMER" ;
      SIZE 100,35 PIXEL OF oDlg FLAT ;
      ACTION ( CursorWait(), oRs:Requery( aSql[ 1 ] ), oRs:SetXbrColumns( oBrw ) )

   @ 20,140 BTNBMP PROMPT "STATES" ;
      SIZE 100,35 PIXEL OF oDlg FLAT ;
      ACTION ( CursorWait(), oRs:Requery( aSql[ 2 ] ), oRs:SetXbrColumns( oBrw ) )

   @ 20,260 BTNBMP PROMPT "ANNUAL" ;
      SIZE 100,35 PIXEL OF oDlg FLAT ;
      ACTION ( CursorWait(), oRs:Requery( aSql[ 3 ] ), oRs:SetXbrColumns( oBrw ) )

   ACTIVATE DIALOG oDlg CENTERED

   oCn:Close()

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FWH: MySql/MariaDB: RowSet object

Postby goosfancito » Sun Dec 12, 2021 10:05 pm

TEngo esta consulta:
Code: Select all  Expand view
#define QUINCENA ;
"select " + ;
"a.id          as c1, " + ;
"b.nombre      as c2, " +;
"a.fecha       as c3, " + ;
"c.id          as c4_0, " +;
"c.item        as c4, " +;
"a.pago        as c5, " + ;
"a.pobreza     as c6, " + ;
"a.gratis      as c7 " + ;
"from tbdiario a " + ;
"left join tbente as b on b.id = a.idente " +;
"left join tbitems as c on c.id = a.iditem "+;
"WHERE a.fecha >= ? AND a.fecha <= ? "+ ;
"ORDER BY a.iditem, a.fecha "
 


y hago lo siguiente:
::oQry := ::oCnx:QUERY( QUINCENA, { ::dInicio, ::dFinal } )
::oQry:setfilter( "c4_0>0 and c4_0<11" )


pero necesito que este ordenado por los campos "c2" y "c3" pero no logro hacerlo, solo me ordena por "c3"
Code: Select all  Expand view
  ::oQry:setorder( "c2", "c3" )
   ::oQry:Requery() 
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: FWH: MySql/MariaDB: RowSet object

Postby vilian » Mon Dec 13, 2021 10:49 am

Please try:

::oQry:setorder( "c2,c3" )

::oQry:Requery() Is not necessary here.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 920
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: FWH: MySql/MariaDB: RowSet object

Postby goosfancito » Wed Dec 15, 2021 1:29 am

AL hacer esto:
Code: Select all  Expand view
        ::oQry:setFilter( "c2_0<2" )
         ::oQry:setorder("c2_0, c3, c4_0")


y luego hacer
Code: Select all  Expand view
xbrowser ::oQry


solo me ordena por el campo c2_0 el resto no le da importancia
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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