Jump to content

amonkey

Members
  • Posts

    2
  • Joined

  • Last visited

amonkey's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thank you for this. Implemented and working flawlessly. It is much appreciated! I did not know about recursive functions. After reading the wiki, I believe I have a grasp around how they operate. Also, thank you for the information about ReDim being slow.
  2. The below code will sort the provided data into a hierarchy… Only 4 levels deep. What logic would I need to use to sort data an unlimited number of levels. #include <Array.au3> Local $array[10][03] = [["01", "Cat01", "0"],["02", "Cat02", "01"],["03", "Cat03", "0"],["04", "Cat04", "03"],["05", "Cat05", "01"],["06", "Cat06", "05"],["07", "Cat07", "01"],["08", "Cat08", "06"],["09", "Cat09", "04"],["010", "Cat010", "08"]] Local $icount Local $arraysort[1] For $a = 0 To UBound($array) - 1 If $array[$a][2] = '0' Then $icount += 1 _ArrayInsert($arraysort, $icount, $array[$a][1]) $array[$a][2] = "" For $b = 0 To UBound($array) - 1 If $array[$b][2] = $array[$a][0] Then $icount += 1 _ArrayInsert($arraysort, $icount, "- " & $array[$b][1]) $array[$b][2] = "" For $c = 1 To UBound($array) - 1 If $array[$c][2] = $array[$b][0] Then $icount += 1 _ArrayInsert($arraysort, $icount, "- - " & $array[$c][1]) $array[$c][2] = "" For $d = 1 To UBound($array) - 1 If $array[$d][2] = $array[$c][0] Then $icount += 1 _ArrayInsert($arraysort, $icount, "- - - " & $array[$d][1]) $array[$d][2] = "" For $e = 1 To UBound($array) - 1 If $array[$e][2] = $array[$d][0] Then $icount += 1 _ArrayInsert($arraysort, $icount, "- - - - " & $array[$e][1]) $array[$e][2] = "" EndIf Next EndIf Next EndIf Next EndIf Next EndIf Next _ArrayDisplay($arraysort, "$arraysort")
×
×
  • Create New...