Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #10630 > unrolled thread
| Started by | "Jose F Zouain" <jfzouain@zetaconcepts.com> |
|---|---|
| First post | 2017-05-31 21:46 +0000 |
| Last post | 2017-06-01 10:19 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
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
| From | "Jose F Zouain" <jfzouain@zetaconcepts.com> |
|---|---|
| Date | 2017-05-31 21:46 +0000 |
| Subject | Get value from a multidimensional array |
| Message-ID | <ep8rt3F5p2qU1@mid.individual.net> |
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
[toc] | [next] | [standalone]
| From | Franz Rachbauer <office@rachbauer.org> |
|---|---|
| Date | 2017-06-01 06:51 +0200 |
| Message-ID | <ogo6g7$11st$1@gioia.aioe.org> |
| In reply to | #10630 |
Hi Jose, SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[zLengua,n,2]) should be the right syntax. Regards, Franz Am 31.05.2017 um 23:46 schrieb Jose F Zouain: > 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]])
[toc] | [prev] | [next] | [standalone]
| From | "Jose F Zouain" <jfzouain@zetaconcepts.com> |
|---|---|
| Date | 2017-06-01 12:00 +0000 |
| Message-ID | <epadv9Fgh0rU1@mid.individual.net> |
| In reply to | #10631 |
Franz Rachbauer wrote: > Hi Jose, > SELF:oServerDetail:FIELDPUT(#TRANSCOD, aTranscod[zLengua,n,2]) > should be the right syntax. > Regards, Franz > > Am 31.05.2017 um 23:46 schrieb Jose F Zouain: > > 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]]) Hi Frans, Wolfgang Thanks both for replying so quick. Used Franz approach, saw my mistake. Best regards Jose Zouain --
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2017-06-01 10:19 +0200 |
| Message-ID | <epa0vvFdhtfU1@mid.individual.net> |
| In reply to | #10630 |
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
--
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web