matriz 8x8
Moderator: Rathinagiri
matriz 8x8
there is a function to add data on a bidirectional array Array (8.8)
ex.
aQuery[1][1] := 10
aQuery[1][2] := 20
aQuery[1][3] := 30
aQuery[1][4] := 40
aQuery[1][5] := 50
aQuery[1][6] := 60
aQuery[1][7] := 70
aQuery[1][8] := 80
aQuery[2][1] := 100
aQuery[2][2] := 200
aQuery[2][3] := 300
aQuery[2][4] := 400
aQuery[2][5] := 500
aQuery[2][6] := 600
aQuery[2][7] := 700
aQuery[2][8] := 800
aQuery[i2] := oRow:FieldGet(i2) ok It works normal
AADD(aQuery[i2], oRow:FieldGet(i2) ) It does not work
ex.
aQuery[1][1] := 10
aQuery[1][2] := 20
aQuery[1][3] := 30
aQuery[1][4] := 40
aQuery[1][5] := 50
aQuery[1][6] := 60
aQuery[1][7] := 70
aQuery[1][8] := 80
aQuery[2][1] := 100
aQuery[2][2] := 200
aQuery[2][3] := 300
aQuery[2][4] := 400
aQuery[2][5] := 500
aQuery[2][6] := 600
aQuery[2][7] := 700
aQuery[2][8] := 800
aQuery[i2] := oRow:FieldGet(i2) ok It works normal
AADD(aQuery[i2], oRow:FieldGet(i2) ) It does not work
Last edited by jairpinho on Mon Apr 24, 2017 5:37 pm, edited 1 time in total.
Re: matriz 8x8
Are you sure that aQuery[12] is array?
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: matriz 8x8
Olá Jair,
AADD(aQuery[I2], oRow:FieldGet(I2) ) está adicionando outro elemento dentro do outro elemento na posição 12 em aQuery[I2].
AADD(aQuery[I2], oRow:FieldGet(I2) ) está adicionando outro elemento dentro do outro elemento na posição 12 em aQuery[I2].
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: matriz 8x8
jairpinho wrote: ↑Mon Apr 24, 2017 5:04 am there is a function to add data on a bidirectional array Array (8.8)
ex.
aQuery[1][1] := 10
aQuery[1][2] := 20
aQuery[1][3] := 30
aQuery[1][4] := 40
aQuery[1][5] := 50
aQuery[1][6] := 60
aQuery[1][7] := 70
aQuery[1][8] := 80
aQuery[2][1] := 100
aQuery[2][2] := 200
aQuery[2][3] := 300
aQuery[2][4] := 400
aQuery[2][5] := 500
aQuery[2][6] := 600
aQuery[2][7] := 700
aQuery[2][8] := 800
aQuery[i2] := oRow:FieldGet(i2) ok It works normal
AADD(aQuery[i2], oRow:FieldGet(i2) ) It does not work
Re: matriz 8x8
In this case, the array item assigns a new value:
Ps. For the future, try to use [ code ] tags, because as it is now, [ i ] treat it as italics.
And in this case, you try to add a new array item:Code: Select all
aQuery[i][i2] := oRow:FieldGet(i2) ok It works normal
If you want to add a new array item I think you should do this:Code: Select all
AADD(aQuery[i][i2], oRow:FieldGet(i2) ) It does not work
Code: Select all
AADD(aQuery[i], oRow:FieldGet(i2) )
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: matriz 8x8
Sim. E daí Jair ???jairpinho wrote: ↑Mon Apr 24, 2017 5:38 pmjairpinho wrote: ↑Mon Apr 24, 2017 5:04 am there is a function to add data on a bidirectional array Array (8.8)
ex.Code: Select all
aQuery[1][1] := 10 aQuery[1][2] := 20 aQuery[1][3] := 30 aQuery[1][4] := 40 aQuery[1][5] := 50 aQuery[1][6] := 60 aQuery[1][7] := 70 aQuery[1][8] := 80 aQuery[2][1] := 100 aQuery[2][2] := 200 aQuery[2][3] := 300 aQuery[2][4] := 400 aQuery[2][5] := 500 aQuery[2][6] := 600 aQuery[2][7] := 700 aQuery[2][8] := 800 aQuery[i][i2] := oRow:FieldGet(i2) ok It works normal AADD(aQuery[i][i2], oRow:FieldGet(i2) ) It does not work
Depois de você ter reditado a sua mensagem, você quer dizer o quê exatamente ?
Acho muito rude da sua parte não ter respondido a minha explicação.
Mas de qualquer forma o que colega te disse é o mesmo que eu te disse.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: matriz 8x8
PortuguêsPablo César wrote: ↑Tue Apr 25, 2017 12:06 amSim. E daí Jair ???jairpinho wrote: ↑Mon Apr 24, 2017 5:38 pmjairpinho wrote: ↑Mon Apr 24, 2017 5:04 am there is a function to add data on a bidirectional array Array (8.8)
ex.Code: Select all
aQuery[1][1] := 10 aQuery[1][2] := 20 aQuery[1][3] := 30 aQuery[1][4] := 40 aQuery[1][5] := 50 aQuery[1][6] := 60 aQuery[1][7] := 70 aQuery[1][8] := 80 aQuery[2][1] := 100 aQuery[2][2] := 200 aQuery[2][3] := 300 aQuery[2][4] := 400 aQuery[2][5] := 500 aQuery[2][6] := 600 aQuery[2][7] := 700 aQuery[2][8] := 800 aQuery[i][i2] := oRow:FieldGet(i2) ok It works normal AADD(aQuery[i][i2], oRow:FieldGet(i2) ) It does not work
Depois de você ter reditado a sua mensagem, você quer dizer o quê exatamente ?
Screen197.png
Acho muito rude da sua parte não ter respondido a minha explicação.
Mas de qualquer forma o que colega te disse é o mesmo que eu te disse.
Ola Pablo não funciona o array fica vazio tento visualizar ele a cada elemento preenchido via msginfo(aquery[i2]) ou msginfo(aquery[i,i2])
estou executando um for mas porque não funciona assim tentei das duas forma porem não preenche estou tentando visualizar o array inteiro com a função hb_arraygetc(aQuery) em um edit box porem também não consigo diz que esta função não existe tentei outra array2string tambem nao existe não sei qual lib adicionar para encontrar estas função
English
Hello Pablo, it does not work the array is empty, I try to see it with each element filled in via msginfo (aquery [i2]) or msginfo (aquery [i, i2])
I'm running a for but it does not work so I tried both ways but it does not fill I'm trying to visualize the entire array with the function hb_arraygetc (aQuery) in an edit box but also I can not say that this function does not exist I tried another array2string also does not exist I know which lib add to find these function
Code: Select all
AADD(aQuery[i][i2], oRow:FieldGet(i2) ) preenche vazio / Fills empty
AADD(aQuery[i], oRow:FieldGet(i2) ) preenche vazio / Fills empty
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: matriz 8x8
Olha Jair, eu utilizo muito o MsgDebug. É uma mão na roda e muito mais fácil de usar que o MsgInfo porque você não precisa transformar nada.
Você vai ver o conteúdo dos elementos TODOS do seu array. Isso se eles não forem tremendamente grandes, que neste seu caso eu duvido. Mas se você usar, vai saber do que eu e o edk estamos falando.
Outra coisa: o quê significa i2 ? Eu nunca usei assim. Para mim os endereços de vetores bidirecionais são endereçados assim:
[ i, u ] que podem serem varridos por dois laços de repetição um com variável i e o outro com variável u, por exemplo.
Use MsgDebug( aQuery )
Você vai ver o conteúdo dos elementos TODOS do seu array. Isso se eles não forem tremendamente grandes, que neste seu caso eu duvido. Mas se você usar, vai saber do que eu e o edk estamos falando.
Outra coisa: o quê significa i2 ? Eu nunca usei assim. Para mim os endereços de vetores bidirecionais são endereçados assim:
[ i, u ] que podem serem varridos por dois laços de repetição um com variável i e o outro com variável u, por exemplo.
Use MsgDebug( aQuery )
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: matriz 8x8
I have tested adding array elements in several ways and it works fine:
If you want to add an element to a multidimensional array, then the parent element must also be an array. (See the differences in examples 3.png and 6.png: AADD(aQuery, {2}) vs. AADD(aQuery, 4) )
In the last example, you can't add to the fourth item of the array of the next item., ex. AADD(aQuery[4], 4) occurs error.
Or maybe you are adding another item to the sub-array then it will be the third item?
Code: Select all
aQuery:={}
msgdebug(aQuery)
Code: Select all
AADD(aQuery, {1,1})
msgdebug(aQuery)
msgdebug(aQuery[1])
Code: Select all
AADD(aQuery, {2})
msgdebug(aQuery)
msgdebug(aQuery[2])
Code: Select all
AADD(aQuery[2], 2)
msgdebug(aQuery)
msgdebug(aQuery[2])
Code: Select all
AADD(aQuery, {3})
AADD(aQuery[3], {3})
msgdebug(aQuery)
msgdebug(aQuery[3])
Code: Select all
AADD(aQuery, 4)
msgdebug(aQuery)
msgdebug(aQuery[4])
In the last example, you can't add to the fourth item of the array of the next item., ex. AADD(aQuery[4], 4) occurs error.
Maybe before adding an item, try to query its value: MsgDebug(oRow:FieldGet(i2))jairpinho wrote: ↑Tue Apr 25, 2017 12:52 amCode: Select all
AADD(aQuery[i][i2], oRow:FieldGet(i2) ) preenche vazio / Fills empty AADD(aQuery[i], oRow:FieldGet(i2) ) preenche vazio / Fills empty
Or maybe you are adding another item to the sub-array then it will be the third item?
Code: Select all
AADD(aQuery[2], 20)
msgdebug(aQuery)
msgdebug(aQuery[2])