FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Passing column-info via variable to twbrowse
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Passing column-info via variable to twbrowse
Posted: Thu Oct 11, 2012 11:29 AM
Hi,

I'm converting some self created function from DBF to ADO/MySQL

In a browse-routine I gine the information of the field-info with a parameter like :
Code (fw): Select all Collapse
vvelden = 'FACTUI->FACTUURNR,FACTUI->FIRMA'
browse(..,..,..,..,vvelden)

Func mbrowse(..,..,..,..,vvelden
 REDEFINE LISTBOX sGetlist FIELDS &(vVelden) ALIAS alias() HEADER &(vTitels) ID 101 OF oDlg COLOR 'N/W*'


This is working fine.
I want to reuse the function for ADO, but here I have a problem
This is what I do:
Code (fw): Select all Collapse
vvelden = 'oRs:fields("FACTUURNR"):value,oRs:fields("FIRMA"):value'
browse(..,..,..,..,vvelden)

Func mbrowse(..,..,..,..,vvelden
 REDEFINE LISTBOX sGetlist FIELDS &(vVelden) HEADER &(vTitels) ID 101 OF oDlg COLOR 'N/W*'


The error that U get is 'Variable does not exist oRs'

When I do this:
Code (fw): Select all Collapse
REDEFINE LISTBOX sGetlist FIELDS oRs:fields("FACTUURNR"):value,oRs:fields("FIRMA"):value HEADER &(vTitels) ID 101 OF oDlg COLOR 'N/W*'

It's working fine.

How can I use a variable to assinging the fields?
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Passing column-info via variable to twbrowse
Posted: Thu Oct 11, 2012 01:14 PM
Marc

I asked ( sort of ) the same question using xBrowse ..

viewtopic.php?f=3&t=24993

The key was creating an array for the Headers

aHeader := {}
AAdd( aHeader, "Column1" )
AAdd( aHeader, "Column2" )
AAdd( aHeader, "Column3" )

Func mbrowse(..,..,..,..,aHeader )

Not sure this will work with listbox ( i prefer xBrowse ) ..
Code (fw): Select all Collapse
REDEFINE LISTBOX sGetlist ;
              FIELDS &(vVelden);
              ALIAS alias() ;
              HEADER aHeader ;
              ID 101 OF oDlg COLOR 'N/W*'


Rick Lipkin
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Passing column-info via variable to twbrowse
Posted: Thu Oct 11, 2012 04:02 PM

Rick,

I want to pass the fields and not the headers.
Passing an array doesn't work for the fields.

I also prefer xBrowse, but this is an old function that I still have to convert to xbrowse...

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Passing column-info via variable to twbrowse
Posted: Thu Oct 11, 2012 06:37 PM

Is this possible?

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Passing column-info via variable to twbrowse
Posted: Fri Oct 12, 2012 03:43 AM

Please declare oRs as a PRIVATE variable in the same function. NOT as local.
Macro expansion needs this.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Passing column-info via variable to twbrowse
Posted: Fri Oct 12, 2012 08:32 AM
nageswaragunupudi wrote:Please declare oRs as a PRIVATE variable in the same function. NOT as local.
Macro expansion needs this.


Thanks,

Now it's working.
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion