Wingens Posted March 1, 2019 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?
rm4453 Posted March 1, 2019 Posted March 1, 2019 Can you please post some code you have attempted already?
Subz Posted March 1, 2019 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) jimmy123j and iamtheky 2
rm4453 Posted March 1, 2019 Posted March 1, 2019 $j = 0 $sum = 0 While $j < UBound($array) - 1 $sum = $sum + $array[$j][1] WEnd
Wingens Posted March 1, 2019 Author 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.
rm4453 Posted March 1, 2019 Posted March 1, 2019 On 3/1/2019 at 11:26 AM, 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. Expand Please try the solutions above and let us know if they work for you / any other issues you run into.
Wingens Posted March 1, 2019 Author 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!
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