edutraini Posted August 24, 2016 Report Share Posted August 24, 2016 Pessoal existe algum comando para verificar se já existe um determinado conteúdo dentro de uma matriz antes de gravar dentro dela Quote Link to comment Share on other sites More sharing options...
aferra Posted August 24, 2016 Report Share Posted August 24, 2016 será que é isso LEN(aArray) ou EMPTY( aArray[1]) ou EMPTY(aArray[1,1]) Quote Link to comment Share on other sites More sharing options...
edutraini Posted August 24, 2016 Author Report Share Posted August 24, 2016 Bom dia, acho que não expressei bem preciso saber se dentro da matriz já tem um determinado valor para que não grave de novo para ficar em duplicidade Quote Link to comment Share on other sites More sharing options...
CIACPD Posted August 24, 2016 Report Share Posted August 24, 2016 De uma olhada no código abaixo, se não entender pergunta novamente function at_saldo_especie() npos_array := ascan( a_fecha_mv_cai_esp ,{|e| e[1]== caixa->CODESP }) if npos_array > 0 if caixa->tipmov = "S" a_fecha_mv_cai_esp[npos_array, 03] += caixa->VLTOT else a_fecha_mv_cai_esp[npos_array, 04] += caixa->VLTOT endif else if caixa->tipmov = "S" cdesesp_cai:= localiza_esp(caixa->CODESP) aadd( a_fecha_mv_cai_esp, { caixa->CODESP , cdesesp_cai , caixa->VLTOT , 0 , caixa->TIPOPE } ) else cdesesp_cai:= localiza_esp(caixa->CODESP) aadd( a_fecha_mv_cai_esp, { caixa->CODESP , cdesesp_cai , 0 , caixa->VLTOT , caixa->TIPOPE } ) endif endif Return .T. Daniel Segura Quote Link to comment Share on other sites More sharing options...
sambomb Posted August 25, 2016 Report Share Posted August 25, 2016 aArray := {"002", "SAMIR", "TESTE"}? aScan(aArray,"001") //-- 0? aScan(aArray,"002") //-- 1? aScan(aArray,"003") //-- 0? aScan(aArray,"SAMIR") //-- 2? aScan(aArray,"TESTE") //-- 3aArray := {{"001", "SAMIR", "TESTE"},{"002", "JOAO", "TESTA"}}? aScan(aArray,{|X| X[1] = "001"}) //-- 1? aScan(aArray,{|X| X[1] = "002"}) //-- 2 ? aScan(aArray,{|X| X[2] = "SAMIR"}) //-- 2 ? aScan(aArray,{|X| X[2] = "JOAO"}) //-- 2 ? aScan(aArray,{|X| X[3] = "TESTE"}) //-- 1 ? aScan(aArray,{|X| X[3] = "TESTA"}) //-- 2 Theotokos 1 Quote Link to comment Share on other sites More sharing options...
edutraini Posted August 25, 2016 Author Report Share Posted August 25, 2016 Obrigado a todos vou testar Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.