Ladinilson Posted October 2, 2023 Report Share Posted October 2, 2023 Boa tarde caros colegas, Como faço um filtro para multiplos elementos dentro de uma array por exemplo: AADD(aCartelas,{Cartelas->n01,Cartelas->n02,Cartelas->n03,Cartelas->n04,Cartelas->n05,Cartelas->n06,Cartelas->n07,Cartelas->n08,Cartelas->n09,Cartelas->n10,Cartelas->n11,Cartelas->n12,; Cartelas->n13,Cartelas->n14,Cartelas->n15,Cartelas->n16,Cartelas->n17,Cartelas->n18,Cartelas->n19,Cartelas->n20,Cartelas->n21,Cartelas->n22,Cartelas->n23,Cartelas->n24}) E filtrar todos que tenham o valor 10 em qualquer posição por exemplo? Obrigado Quote Link to comment Share on other sites More sharing options...
macs Posted October 2, 2023 Report Share Posted October 2, 2023 FUNCTION GetNewArray( xVal ) LOCAL aNewArray := {} LOCAL aArrayAux := {} LOCAL nX FOR nX := 1 TO Len( aCartelas ) aArrayAux := aCartelas[ nX ] IF AScan( aArrayAux, { | aX | aX == xVal } ) <> 0 aAdd( aNewArray, AClone( aArrayAux ) ) ENDIF NEXT RETURN aNewArray rochinha 1 Quote Link to comment Share on other sites More sharing options...
Ladinilson Posted October 2, 2023 Author Report Share Posted October 2, 2023 7 minutos atrás, macs disse: FUNCTION GetNewArray( xVal ) LOCAL aNewArray := {} LOCAL aArrayAux := {} LOCAL nX FOR nX := 1 TO Len( aCartelas ) aArrayAux := aCartelas[ nX ] IF AScan( aArrayAux, { | aX | aX == xVal } ) <> 0 aAdd( aNewArray, AClone( aArrayAux ) ) ENDIF NEXT RETURN aNewArray Valeu irmão, 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.