Kyan Posted November 15, 2014 Posted November 15, 2014 Hi, there's any function to do this? Or it needs to be done one by one? (redim $arraybase[ubond($arraybase)][ubond($arraybase,2)+1]...) I tried with _arrayadd example but my output is the same: Local $aArray, $sFill Local $aArray_Base[2][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"]] _ArrayDisplay($aArray_Base, "2D - Base array") ; Add item delimited string $aArray = $aArray_Base $sFill = "New Item 2 - 0|New Item 2 - 1" _ArrayAdd($aArray, $sFill) _ArrayDisplay($aArray, "2D - Item delimited") thank you, and sorry for the simple question Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Moderators SmOke_N Posted November 15, 2014 Moderators Posted November 15, 2014 Maybe use UBound instead of ubond? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators Melba23 Posted November 15, 2014 Moderators Posted November 15, 2014 Kyan,Your code as posted works fine for me. As the 2 arrays have the same number of columns you can also concatenate them a shown here: #include <Array.au3> Local $aArray, $sFill Local $aArray_Base[2][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"]] _ArrayDisplay($aArray_Base, "2D - Base array") ; Add item delimited string $aArray = $aArray_Base $sFill = "Add Item 2 - 0|Add Item 2 - 1" _ArrayAdd($aArray, $sFill) _ArrayDisplay($aArray, "2D - Item delimited") ; Or concatenate 2 arrays $aArray = $aArray_Base Local $aArray_Add[1][2] = [["Conc Item 2 - 0", "Conc Item 2 - 1"]] _ArrayConcatenate($aArray, $aArray_Add) _ArrayDisplay($aArray, "2D - Concatenated"One final question - which AutoIt version do you use? The new Array library was added in 3.3.12.0 and the old versions had less functionality - which may explain why the functions do not work for you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Solution mikell Posted November 15, 2014 Solution Posted November 15, 2014 (edited) Melba doesn't the topic title say add columns ? #include <Array.au3> Local $aArray[3][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"],["Item 2 - 0", "Item 2 - 1"]] Local $aFill[3] = ["Add Item 2 - 0", "Add Item 2 - 1", "Add Item 2 - 2"] _ArrayDisplay($aArray) $u = UBound($aArray) $c = UBound($aArray, 2) ReDim $aArray[$u][$c + 1] For $i = 0 to $u - 1 $aArray[$i][$c] = $aFill[$i] Next _ArrayDisplay($aArray, "Redimmed") ; OR Local $aArray[3][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"],["Item 2 - 0", "Item 2 - 1"]] ; Local $sFill = "Add Item 2 - 0|Add Item 2 - 1|Add Item 2 - 2" Local $aFill[1][3] = [["Add Item 2 - 0","Add Item 2 - 1","Add Item 2 - 2"]] _ArrayTranspose($aArray) ; _ArrayAdd($aArray, $sFill) _ArrayAdd($aArray, $aFill) _ArrayTranspose($aArray) _ArrayDisplay($aArray, "Concatenated") Edited November 15, 2014 by mikell Zedna 1
Moderators Melba23 Posted November 15, 2014 Moderators Posted November 15, 2014 mikell,Indeed it does - but the example code suggests that the OP actually means "Rows" as the data to be added is obviously a new row. Let us wait and see. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Kyan Posted November 15, 2014 Author Posted November 15, 2014 Maybe use UBound instead of ubond? Yes, I wrote that from memory, was late didn't check spelling Kyan, Your code as posted works fine for me. As the 2 arrays have the same number of columns you can also concatenate them a shown here: One final question - which AutoIt version do you use? The new Array library was added in 3.3.12.0 and the old versions had less functionality - which may explain why the functions do not work for you. M23 @AutoItVersion gives me "3.3.10.2", hitted F1 and my help file doesn't have so many parameters on the _ArrayAdd function I wanted to add a nem column by merging a 1D array, like $baseArray[n][c+1], though _arrayadd could do that job Thank you Melba doesn't the topic title say add columns ? #include <Array.au3> Local $aArray[3][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"],["Item 2 - 0", "Item 2 - 1"]] Local $aFill[3] = ["Add Item 2 - 0", "Add Item 2 - 1", "Add Item 2 - 2"] _ArrayDisplay($aArray) $u = UBound($aArray) $c = UBound($aArray, 2) ReDim $aArray[$u][$c + 1] For $i = 0 to $u - 1 $aArray[$i][$c] = $aFill[$i] Next _ArrayDisplay($aArray, "Redimmed") ; OR Local $aArray[3][2] = [["Item 0 - 0", "Item 0 - 1"],["Item 1 - 0", "Item 1 - 1"],["Item 2 - 0", "Item 2 - 1"]] ; Local $sFill = "Add Item 2 - 0|Add Item 2 - 1|Add Item 2 - 2" Local $aFill[1][3] = [["Add Item 2 - 0","Add Item 2 - 1","Add Item 2 - 2"]] _ArrayTranspose($aArray) ; _ArrayAdd($aArray, $sFill) _ArrayAdd($aArray, $aFill) _ArrayTranspose($aArray) _ArrayDisplay($aArray, "Concatenated") 1st Example works perfectly, thank you very much 2nd is not working,maybe due to have a old autoit version, need to update it. But good thinking, transpose them to two rows, add a new row, and then put them pack together as columns Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
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