Passing column-info via variable to twbrowse

Passing column-info via variable to twbrowse

Postby Marc Vanzegbroeck » 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: Select all  Expand view  RUN
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: Select all  Expand view  RUN
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: Select all  Expand view  RUN
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Passing column-info via variable to twbrowse

Postby Rick Lipkin » Thu Oct 11, 2012 1: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: Select all  Expand view  RUN

REDEFINE LISTBOX sGetlist ;
              FIELDS &(vVelden);
              ALIAS alias() ;
              HEADER aHeader ;
              ID 101 OF oDlg COLOR 'N/W*'
 


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Passing column-info via variable to twbrowse

Postby Marc Vanzegbroeck » Thu Oct 11, 2012 4: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Passing column-info via variable to twbrowse

Postby Marc Vanzegbroeck » Thu Oct 11, 2012 6:37 pm

Is this possible?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Passing column-info via variable to twbrowse

Postby nageswaragunupudi » Fri Oct 12, 2012 3: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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Passing column-info via variable to twbrowse

Postby Marc Vanzegbroeck » Fri Oct 12, 2012 8: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests