MySql OrdScope SOLUCIONADO

Post Reply
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

MySql OrdScope SOLUCIONADO

Post by D.Fernandez »

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, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: MySql OrdScope SOLUCIONADO

Post by nageswaragunupudi »

fwh\samples\maria04.prg
Regards

G. N. Rao.
Hyderabad, India
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

Re: MySql OrdScope SOLUCIONADO

Post by D.Fernandez »

Thank you Mr. Rao.

Saludps Ruben Fernandez
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: MySql OrdScope SOLUCIONADO

Post by nageswaragunupudi »

Many ways of doing it

1)

Code: Select all

#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

#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
Post Reply