FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Know the exactly field from xbrowse
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Know the exactly field from xbrowse
Posted: Fri May 03, 2013 09:34 AM

If I have a xbrowse I must populate 3 array

    Local  nLen := Len( oGrid:aCols )
    Local   aCampos [ nLen ]
    Local   aTitulos[ nLen ]
    Local   aTipos  [ nLen ]

FOR n = 1 TO nLen
aCampos [ n ]:= alltrim( cValToChar( (oGrid:cAlias)->( Fieldname( oGrid:aCols[ n ]:nCreationOrder ) ) ))
aTitulos [ n ]:= oGrid:aCols[ n ]:cHeader
aTipos [ n ]:= oGrid:aCols[ n ]:cDataType
NEXT

For the aCampos array it run bad because it take fields of database from first field
If I have 14 colums on xbrowse it take the first 14 fields and not the exactly fields of relative column

How I can to save on aCampos array the fileds right ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 58
Joined: Thu Oct 13, 2005 01:26 PM
Re: Know the exactly field from xbrowse
Posted: Fri May 03, 2013 10:12 AM

Hello Silvio

Local R:=oBRW:nArrayAt // rigo array
Local Z:=oBRW:nCOLSEL // colonna selezionata
Local oCOL:=oBRW:aCols[Z] // txcolonna
Local C:=oCOL:nArrayCol // indice colonna array - come ARR_X[R][H]
Local nDATO:=oCOL:Value() // dato dentro la cella

Local nDATO:=ARR_X[R][C]

Best Regards
Santo

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Know the exactly field from xbrowse
Posted: Fri May 03, 2013 11:10 AM
Hello Santo,
I call a function ang give to this function only the object of xbrowse
sample test1(ogrid)

on this function I must create the array for fields, header and type
I hope you understood


In italian
devo sapere quali sono i nomi dei campi delle colonne della tabella passata alla funzione
il comando alltrim( cValToChar( (oGrid:cAlias)->( Fieldname( oGrid:aCols[ n ]:nCreationOrder ) ) ))
restituisce i campi partendo dall'inizio cioè dal primo campo del database
se i campi che ho nella tabella sono 14 lui prende solo i primi 14 campi e non quelli effettivamente posti in tabella
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Know the exactly field from xbrowse
Posted: Fri May 03, 2013 05:50 PM

oCol:cExpr gives the fieldname.

Note: If you created xbrowse with full command syntax

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Know the exactly field from xbrowse
Posted: Fri May 03, 2013 06:25 PM
I'm creating a filter function to create filters string

I created xbrowse with

Code (fw): Select all Collapse
Function test()

aCampi := { "CODCF", "RAGSOC", "RAGSOC1", "INDIR" } 
aNomi:= {"Codice","Ragione Sociale","Ragione Sociale2","Indirizzo Legale"}
aSizes:= {50,250 ,200,100 }

USE CLIENTI ALIAS CLIENTI NEW

LookUp("Clienti",aCampi,aNomi,aSizes,35.7,105,"Anagrafica clienti")

RETURN NIL



ON lookup function there is a xbrowse and a buttonbar 


@ 15.6, 0 XBROWSE oBrw OF oDlgLook SIZE -1,-20 PIXEL ;
DATASOURCE cdbf ;
COLUMNS aCampi HEADERS aNomi COLSIZES aSizes
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Know the exactly field from xbrowse
Posted: Sat May 04, 2013 01:52 AM

Yes, in this case, oCol:cExpr returns the fieldname

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Know the exactly field from xbrowse
Posted: Sat May 04, 2013 08:57 AM

thanks now run ok

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion