Know the exactly field from xbrowse

Know the exactly field from xbrowse

Postby Silvio.Falconi » Fri May 03, 2013 9: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Know the exactly field from xbrowse

Postby vensanto » 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
User avatar
vensanto
 
Posts: 58
Joined: Thu Oct 13, 2005 1:26 pm
Location: ITALIA

Re: Know the exactly field from xbrowse

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Know the exactly field from xbrowse

Postby nageswaragunupudi » Fri May 03, 2013 5:50 pm

oCol:cExpr gives the fieldname.

Note: If you created xbrowse with full command syntax
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Know the exactly field from xbrowse

Postby Silvio.Falconi » Fri May 03, 2013 6:25 pm

I'm creating a filter function to create filters string

I created xbrowse with

Code: Select all  Expand view  RUN
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Know the exactly field from xbrowse

Postby nageswaragunupudi » Sat May 04, 2013 1:52 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Know the exactly field from xbrowse

Postby Silvio.Falconi » Sat May 04, 2013 8:57 am

thanks now run ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 102 guests