MySql OrdScope SOLUCIONADO

MySql OrdScope SOLUCIONADO

Postby D.Fernandez » Sun Dec 27, 2020 5:15 pm

In FIRST xBr I do
oBrw:bChange:= { || ( oRs2:SetFilter( 'subcli= oRs:Fieldget(2) ' ) , oRs2:Update(), xbCli:Refresh(),xTbx:SetFocus() ) }


Hi friends.

I have two xBrowse,
the one with clients and the two with accounts. (one clients has more than 1 account)

THE FIRST xBrowse
FWCONNECT oConsql HOST chost USER cUser PASSWORD cPassword DB cDatabase
oRs := oConSql:RowSet( "select * from clientes" )
oRs:SetOrder(1)
REDEFINE XBROWSE oClient ID 110 Of xDlg1 DATASOURCE oRs

THE SECOND xBrowse
oRs2 := oConSql:RowSet( "select * from cuentas" )

REDEFINE XBROWSE oCuentas ID 115 Of xDlg1 DATASOURCE oRs2

In the ON CHANGE of THE FIRST xBrowse
try to show in the SECOND only the account correnponding to the client in the ONE.

I used Ordscope with CDX, but now i don't know.

oRs:SetFilter(numberofclient) not work.

Thank you.
Best regards
Ruben Dario Fernandez
Dario Fernandez
FWH 22.12, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 455
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: MySql OrdScope SOLUCIONADO

Postby nageswaragunupudi » Mon Dec 28, 2020 10:14 pm

fwh\samples\maria04.prg
Regards

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

Re: MySql OrdScope SOLUCIONADO

Postby D.Fernandez » Tue Dec 29, 2020 12:57 am

Thank you Mr. Rao.

Saludps Ruben Fernandez
Dario Fernandez
FWH 22.12, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 455
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: MySql OrdScope SOLUCIONADO

Postby nageswaragunupudi » Tue Dec 29, 2020 11:11 am

Many ways of doing it

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

static oCn

function Main()

   local oDlg, oFont, oBrwStates, oBrwCust
   local oStates, oCust

   if ( oCn := FW_DemoDB( 1 ) ) == nil
      return nil
   endif

   // OPEN TABLES AND SETF MAIN FILTER

   oStates     := oCn:States   // Parent Rowset
   oCust       := oCn:Customer // Child Rowset
   oCust:SetFilter( "state = ?", { oStates:Code } )

   // BROWSE PARENT AND CHILD

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 900,600 PIXEL TRUEPIXEL ;
      FONT oFont ;
      TITLE "FWH MYSQL PARENT CHILD ROWSET"

   @ 20,20 XBROWSE oBrwStates SIZE 250,-20 PIXEL OF oDlg ;
      DATASOURCE oStates ;
      COLUMNS "Code", "Name" ;
      COLSIZES nil, 50 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrwStates
      :nStretchCol:= 2
      :bChange    := { || oCust:ReFilter( { oStates:code } ), oBrwCust:GoTop(), oBrwCust:Refresh() }
      :CreateFromCode()
   END

   @ 20,270 XBROWSE oBrwCust SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      COLUMNS "First", "City", "State", "Salary" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrwCust
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   oCn:close()
   RETURN NIL

return nil
 


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

static oCn

function Main()

   local oDlg, oFont, oBrwStates, oBrwCust
   local oStates, oCust

   if ( oCn := FW_DemoDB( 1 ) ) == nil
      return nil
   endif

   // OPEN TABLES AND SETF MAIN FILTER

   oStates     := oCn:States   // Parent Rowset
   oCust       := oCn:RowSet( "select * from customer where state = ?", { oStates:Code } ) // Child Rowset

   // BROWSE PARENT AND CHILD

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 900,600 PIXEL TRUEPIXEL ;
      FONT oFont ;
      TITLE "FWH MYSQL PARENT CHILD ROWSET"

   @ 20,20 XBROWSE oBrwStates SIZE 250,-20 PIXEL OF oDlg ;
      DATASOURCE oStates ;
      COLUMNS "Code", "Name" ;
      COLSIZES nil, 50 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrwStates
      :nStretchCol:= 2
      :bChange    := { || oCust:ReQuery( { oStates:code } ), oBrwCust:GoTop(), oBrwCust:Refresh() }
      :CreateFromCode()
   END

   @ 20,270 XBROWSE oBrwCust SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      COLUMNS "First", "City", "State", "Salary" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrwCust
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   oCn:close()
   RETURN NIL

return nil
 
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

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