Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10632

Re: Get value from a multidimensional array

From "Wolfgang Riedmann" <wriedmann@gmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Get value from a multidimensional array
Date 2017-06-01 10:19 +0200
Message-ID <epa0vvFdhtfU1@mid.individual.net> (permalink)
References <ep8rt3F5p2qU1@mid.individual.net>

Show all headers | View raw


Hi Jose,

to work with more than 2 dimension you need to use intermediate
variables.

For example to address

x:= aField[1,2,3]

you need to write

aBuffer := aField[1,2]
x := aBuffer[3]

Wolfgang


Jose F Zouain wrote:

> 
> Hi Guys
> 
> Is me again, all is working good, but now I have  to get the value
> from a multi dimensional array.
> 
> Because we support 3 languages, have to make it work:
> 
> aTranscod :=	{{"Purchase Order","PO"},;
>  						{"Invoice","IN"},;
>  						{"Sales Return","SR"},;
> 						{"Sales Order","SO"},;
>  						{"Repair Order","RO"},;
>  						{"Out Rental","RT"},;
>  						{"In Rental","RI"}} 
> 
> 
> This part works ok:
> 
> sValue := AllTrim(SELF:oDCTRANSCOD:TextValue)
> n := AScan(aTranscod,{|aTranscod|aTranscod[1] == sValue})
> 
> Saving it, is OK:
> SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[n,2)	
> =================================================
> 
> Now we added all 3 languages and zLengua is chosen when the user
> enters the system, for this example zLengua == 2
> 
> 
>   aTranscod :=	{{{"Orden de Compras","PO"},;
>  						{"Factura","IN"},;
>  						{"Devolución","SR"},;
> 						{"Pedido de Ventas","SO"},;
>  						{"Orden de Reparación","RO"},;
>  						{"Salida Renta","RT"},;
>  						{"Entrada Renta","RI"}},;
>  						;		
>  						{{"Purchase Order","PO"},;
>  						{"Invoice","IN"},;
>  						{"Sales Return","SR"},;
> 						{"Sales Order","SO"},;
>  						{"Repair Order","RO"},;
>  						{"Rental Out","RT"},;
>  						{"Rental In","RI"}},;
>  						;	
>  						{{"Ordem de Compra","PO"},;
>  						{"Fatura","IN"},;
>  						{"Retorno de Vendas","SR"},;
> 						{"Pedido de Vendas","SO"},;
>  						{"Ordem de Reparo","RO"},;
>  						{"Saída Aluguel","RT"},;
>  						{"Entrada Aluguel","RI"}}}
> 
> 
> The display works OK:
> oDCTRANSCOD:FillUsing(aTranscod[zLengua])
> 
> Evaluating the array to get 2nd element is OK, with this:
> 
> 
> sValue := AllTrim(SELF:oDCTRANSCOD:TextValue)
> n := AScan(aTranscod[zLengua],{|aTranscod|aTranscod[1] == sValue})
> 
> It displays the correct value, if I choose Invoice or factura or
> fatura == 2
> 
> Now my problem is saving it like before, but looks I can get it to
> work, I know it should be a stupid thing, but need some help again:
> 
> This part is not working
> SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[zLengua[n,2]])		
> 
> Neither this
> SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[zLengua],[n,2])
> 
> This one, it doesn't even compiles:
> SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[zLengua,[n,2]])	
> 
> 
> If I select Invoice, it should save like before "IN"
> 
> Help again please
> 
> Thanks
> 
> Jose



-- 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Get value from a multidimensional array "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-05-31 21:46 +0000
  Re: Get value from a multidimensional array Franz Rachbauer <office@rachbauer.org> - 2017-06-01 06:51 +0200
    Re: Get value from a multidimensional array "Jose F Zouain" <jfzouain@zetaconcepts.com> - 2017-06-01 12:00 +0000
  Re: Get value from a multidimensional array "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-06-01 10:19 +0200

csiph-web