Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Wolfgang Riedmann" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: Get value from a multidimensional array Date: Thu, 1 Jun 2017 10:19:11 +0200 Lines: 111 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: individual.net jzzZjWc5pcC32ajgSvCVMg8MzAqBT73dZAgi5/QqtcQ+iR304= Cancel-Lock: sha1:jfxWiIbWX8MQ34TDdd0cJOGaebQ= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:10632 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 --