Page 1 of 1

MySql OrdScope SOLUCIONADO

Posted: Sun Dec 27, 2020 5:15 pm
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

Re: MySql OrdScope SOLUCIONADO

Posted: Mon Dec 28, 2020 10:14 pm
by nageswaragunupudi
fwh\samples\maria04.prg

Re: MySql OrdScope SOLUCIONADO

Posted: Tue Dec 29, 2020 12:57 am
by D.Fernandez
Thank you Mr. Rao.

Saludps Ruben Fernandez

Re: MySql OrdScope SOLUCIONADO

Posted: Tue Dec 29, 2020 11:11 am
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