Tdolphin y el fillarray

Tdolphin y el fillarray

Postby goosfancito » Thu Dec 12, 2019 11:45 pm

Hola.
Code: Select all  Expand view
aPaises := oCn:Execute( "select pais from paises" )


esto me trae un ARRAY con varias columnas, yo necesito solamente la columna de del dato de "pais" no con todo el resto,
como deberia de hacerlo?

gracias.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Tdolphin y el fillarray

Postby nageswaragunupudi » Fri Dec 13, 2019 2:26 am

goosfancito wrote:Hola.
Code: Select all  Expand view
aPaises := oCn:Execute( "select pais from paises" )


esto me trae un ARRAY con varias columnas, yo necesito solamente la columna de del dato de "pais" no con todo el resto,
como deberia de hacerlo?

gracias.

Are you asking the question about TDolphin?

With TDolphin, oCn:Execute( query ) returns a logical value, success of failure of execution of the query. This does not return an array.

If you are using this with FWH MySql library, then
Code: Select all  Expand view

oCn:Execute( "select pais from paises" )
 

returns an array with single column.
Regards

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

Re: Tdolphin y el fillarray

Postby goosfancito » Fri Dec 13, 2019 3:03 am

I asking with tDolphin

Thanks
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Tdolphin y el fillarray

Postby cmsoft » Fri Dec 13, 2019 11:57 am

Hola Gustavo:
Prueba con el siguiente codigo en TDolphin
Code: Select all  Expand view

aPaises:= oCn:Query("SELECT pais FROM paises"):FillArray(,{"pais"})
 


Para ser mas claro, podrias tener una consulta con varios campos y llenar un arreglo con cualquier campo que tengas en la consulta
Code: Select all  Expand view

oQry:= oCn:Query("SELECT codigo,pais,continente FROM paises"
aPaises:= oQry:FillArray(,{"pais"})
aCodigos := oQry:FillArray(,{"codigo"})
 


Espero te sirva
User avatar
cmsoft
 
Posts: 1203
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Tdolphin y el fillarray

Postby MGA » Fri Dec 13, 2019 2:42 pm

/******************************************************************************************************************/
function QueryRetornaArray( cQuery, oServerAuxiliar )
/*
*/
local aDados, oQryArray

Default oServerAuxiliar := M->oServer

if HB_IsNil(oServerAuxiliar)
oServerAuxiliar := M->oServer
endif

oQryArray := oServerAuxiliar:Query( cQuery )
aDados := oQryArray:FillArray()

oQryArray:End()

return(aDados)
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Tdolphin y el fillarray

Postby goosfancito » Fri Dec 13, 2019 10:50 pm

gracias a ambos.
pero... no me devuelve esto:
adato[1]
adato[2]
adato[3]

sino esto:

adatos[1][1]
adatos[1][2]
....

y lo que necesito es solo los "nombres" no con toda la informacion adicional. se Entiende?

gracias.
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm

Re: Tdolphin y el fillarray

Postby nageswaragunupudi » Sat Dec 14, 2019 2:27 am

Code: Select all  Expand view
aPaises:= oQry:FillArray(,{"pais"})
aPaises := ArrTransform( aPaises )[ 1 ]
Regards

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

Re: Tdolphin y el fillarray

Postby goosfancito » Sat Dec 14, 2019 3:13 pm

esa no sabia. gracias
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
User avatar
goosfancito
 
Posts: 1954
Joined: Fri Oct 07, 2005 7:08 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests