Wingens Posted March 1, 2019 Share Posted March 1, 2019 Hi, i am reading out an section of a ini file and this is the array i am getting. What i am trying to get is a sum of al the values in Col1 in the example i would like to get a variable stored with the number 6 It this possible? Link to comment Share on other sites More sharing options...
rm4453 Posted March 1, 2019 Share Posted March 1, 2019 Can you please post some code you have attempted already? Link to comment Share on other sites More sharing options...
Subz Posted March 1, 2019 Share Posted March 1, 2019 Basic example: #include <Array.au3> Local $aArray[3][2] = [[2, ""],[1,5],[3,1]] ConsoleWrite(Execute(_ArrayToString($aArray, "", 1, -1, "+", 1, 1)) & @CRLF) iamtheky and jimmy123j 2 Link to comment Share on other sites More sharing options...
rm4453 Posted March 1, 2019 Share Posted March 1, 2019 $j = 0 $sum = 0 While $j < UBound($array) - 1 $sum = $sum + $array[$j][1] WEnd Link to comment Share on other sites More sharing options...
Wingens Posted March 1, 2019 Author Share Posted March 1, 2019 My code of what i have tried. $aVAR = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $NAAMMEDEWERKER & "\Jaren\" & $VAR & "\vrijvragen.ini", "AANTAL") _ArrayDisplay($aVAR) $test = _ArrayToString($aVAR,"|","","","",1) MsgBox(4096, "Test", $test) For $i = 1 to $aVAR[0][0] $Test = $aVAR[$i][$i] + $aVAR[$i][$i] Next MsgBox(4096, "Done", $Test) Exit a bit more informations the col1 is always the samen the rows are variable some times it shows 1 or 2 rows sometimes it shows a lot more. Link to comment Share on other sites More sharing options...
rm4453 Posted March 1, 2019 Share Posted March 1, 2019 6 minutes ago, Wingens said: My code of what i have tried. $aVAR = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $NAAMMEDEWERKER & "\Jaren\" & $VAR & "\vrijvragen.ini", "AANTAL") _ArrayDisplay($aVAR) $test = _ArrayToString($aVAR,"|","","","",1) MsgBox(4096, "Test", $test) For $i = 1 to $aVAR[0][0] $Test = $aVAR[$i][$i] + $aVAR[$i][$i] Next MsgBox(4096, "Done", $Test) Exit a bit more informations the col1 is always the samen the rows are variable some times it shows 1 or 2 rows sometimes it shows a lot more. Please try the solutions above and let us know if they work for you / any other issues you run into. Link to comment Share on other sites More sharing options...
Wingens Posted March 1, 2019 Author Share Posted March 1, 2019 This one worked for me: $aVAR = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $NAAMMEDEWERKER & "\Jaren\" & $VAR & "\vrijvragen.ini", "AANTAL") $sum = 0 For $i = 1 to $aVAR[0][0] $SUM = $SUM + $aVAR[$i][1] Next Thank you all for the support! Link to comment Share on other sites More sharing options...
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