trescon Posted August 28, 2015 Posted August 28, 2015 Good morning, I state that I am a beginner (use Autoit 2 years, but a few hours per month, and then I learn a little)So my problem is I have a file that I have read and load on a two-dimensional array.The conversion works because if I try to read the individual array data I see them.When I go to read the two-dimensional array with the special command I see written in all fields "array".What could be wrong.thanks#include <array.au3>#include <GuiListView.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>#include <File.au3>Dim $Dati[200],$aItems[10],$prodotti[200][10]_FileReadToArray("C:/Procedure/Archivi/Cove/Variazioni_Listini1.csv", $Dati);_ArrayDisplay($Dati,"pippo")ConsoleWrite($Dati[0] & @crlf)ConsoleWrite($Dati[1] & @crlf) ;### Debug Console for $a = 1 to $Dati[0] $aItems = StringSplit($Dati[$a],";" ,2) for $b = 0 to 8 $Prodotti[$a][$b] = StringSplit($aItems[$b], ";",2) ConsoleWrite($Prodotti[$a][$b] & @crlf) next Next_ArrayDisplay($Prodotti,"pippo")ConsoleWrite($Prodotti[2][0] & @crlf)ConsoleWrite($Prodotti[2][1] & @crlf)ConsoleWrite($aItems[0] & @crlf)ConsoleWrite($aItems[1] & @crlf)ConsoleWrite($aItems[2] & @crlf)ConsoleWrite($aItems[3] & @crlf)ConsoleWrite($aItems[4] & @crlf)ConsoleWrite($aItems[5] & @crlf)ConsoleWrite($aItems[6] & @crlf)ConsoleWrite($aItems[7] & @crlf)ConsoleWrite($aItems[8] & @crlf) Variazioni_Listini1.csv Thank You Alberto --------------------------------------------------- I am translate with Google.
Malkey Posted August 28, 2015 Posted August 28, 2015 All the fields (or elements) of the array have "Array" written in them because all the elements of the array are arrays.because of this line:-$Prodotti[$a][$b] = StringSplit($aItems[$b], ";",2)The StringSplit function returns an array, which is being assigned to the element in the 2D array.#include <array.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> Dim $Dati[200], $aItems[10], $prodotti[200][10] _FileReadToArray("Variazioni_Listini1.csv", $Dati) ; Csv file is in same directory as this script ;_ArrayDisplay($Dati, "pippo") ConsoleWrite($Dati[0] & @CRLF) ConsoleWrite($Dati[1] & @CRLF) ;### Debug Console For $a = 1 To $Dati[0] $aItems = StringSplit($Dati[$a], ";", 2) For $b = 0 To UBound($aItems) - 1 $prodotti[$a - 1][$b] = $aItems[$b] ConsoleWrite($prodotti[$a][$b] & @CRLF) Next ; for $b = 0 to 8 ; $Prodotti[$a][$b] = StringSplit($aItems[$b], ";",2); <-- You are put an array into the 2D element ($Prodotti[$a][$b]) ; ConsoleWrite($Prodotti[$a][$b] & @crlf) ; next Next ReDim $prodotti[$Dati[0]][UBound($aItems)] _ArrayDisplay($prodotti, "pippo")
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now