Array Werte verbinden "Bitte Helfen..."

  • Hallo Leute,

    hab nun mein Array soweit das es mir die Werte, verbunden mit den zugehörigen Werten in der Tabelle, so ausgibt wie ich es haben will. ^^
    Jedoch brauche ich nochmal eure Hilfe... Wie kann ich nun die letzte spalte in meinem Array, welche mit ArrayDisplay dargestellt wird, so entfernen das die vorherigen Daten so stehen bleiben wie sie sind :?:

    Hier mal der Code:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 820, 443, -1, -1)
    $Liste = GUICtrlCreateListView("Pos.|T1|T2|T3|T4|T5|||", 20, 133, 780, 300, BitOR($LVS_REPORT, $LVS_EDITLABELS, $WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE))
    GUICtrlSetResizing(-1, $GUI_DOCKALL)
    _GUICtrlListView_SetColumnWidth($Liste, 0, 130)
    _GUICtrlListView_SetColumnWidth($Liste, 1, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 2, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 3, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 4, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 5, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 6, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 7, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 8, 80)
    _GUICtrlListView_SetExtendedListViewStyle($Liste, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
    GUICtrlCreateListViewItem("A" & "|" & 225 & "|" & 355 & "|" & 400 & "|" & 102 & "|" & 100 & "|" & 50, $Liste)
    GUICtrlCreateListViewItem("B" & "|" & 325 & "|" & 278 & "|" & 400 & "|" & 207 & "|" & 366 & "|" & 50, $Liste)
    GUICtrlCreateListViewItem("C" & "|" & 425 & "|" & 645 & "|" & 500 & "|" & 752 & "|" & 75, $Liste)
    GUICtrlCreateListViewItem("D" & "|" & 225 & "|" & 100 & "|" & 786 & "|" & 400 & "|" & 200 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("E" & "|" & 125 & "|" & 355 & "|" & 900 & "|" & 400 & "|" & 316 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("F" & "|" & 100 & "|" & 355 & "|" & 786 & "|" & 752 & "|" & 30 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("G" & "|" & 355 & "|" & 225 & "|" & 120 & "|" & 400 & "|" & 100, $Liste)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $Button = GUICtrlCreateButton("Stückliste", 350, 60, 120, 25)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button
    arraysearch2()
    arraysearch3()
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func arraysearch2()
    Global $aListe[1]
    $iColumn = _GUICtrlListView_GetColumnCount(GUICtrlGetHandle ($Liste))
    $iRow = _GUICtrlListView_GetItemCount(GUICtrlGetHandle ($Liste))
    If $iRow > 0 Then

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iRow - 1
    For $k = 6 To $iColumn -2
    $sItem = _GUICtrlListView_GetItemText(GUICtrlGetHandle ($Liste), $i, $k)
    For $j = 2 to 2
    $sItem2 = _GUICtrlListView_GetItemText(GUICtrlGetHandle ($Liste), $i, $j)

    [/autoit] [autoit][/autoit] [autoit]

    If $sItem <> "" Then
    $iArraySearch = _ArraySearch($aListe, $sItem & $sItem2)
    If $iArraySearch = -1 Then
    ReDim $aListe[UBound($aListe) + 1][4]
    $aListe[UBound($aListe) - 1][0] = Int ($sItem2)
    $aListe[UBound($aListe) - 1][1] = 1
    $aListe[UBound($aListe) - 1][2] = Int ($sItem)
    $aListe[UBound($aListe) - 1][3] = Int ($sItem & $sItem2)
    Else
    $aListe[$iArraySearch][1] += 1
    EndIf
    EndIf
    Next
    Next
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _ArraySort($aListe, 0, 0, 0, 0)
    _ArrayDisplay($aListe,0)
    $aListe=""

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndFunc
    Func arraysearch3()
    Global $aListe[1]
    $iColumn = _GUICtrlListView_GetColumnCount(GUICtrlGetHandle ($Liste))
    $iRow = _GUICtrlListView_GetItemCount(GUICtrlGetHandle ($Liste))
    If $iRow > 0 Then

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iRow - 1
    For $k = 7 To $iColumn -1
    $sItem = _GUICtrlListView_GetItemText(GUICtrlGetHandle ($Liste), $i, $k)
    For $j = 3 to 3
    $sItem2 = _GUICtrlListView_GetItemText(GUICtrlGetHandle ($Liste), $i, $j)

    [/autoit] [autoit][/autoit] [autoit]

    If $sItem <> "" Then
    $iArraySearch = _ArraySearch($aListe, $sItem & $sItem2)
    If $iArraySearch = -1 Then
    ReDim $aListe[UBound($aListe) + 1][4]
    $aListe[UBound($aListe) - 1][0] = Int ($sItem2)
    $aListe[UBound($aListe) - 1][1] = 1
    $aListe[UBound($aListe) - 1][2] = Int ($sItem)
    $aListe[UBound($aListe) - 1][3] = Int ($sItem & $sItem2)
    Else
    $aListe[$iArraySearch][1] += 1
    EndIf
    EndIf
    Next
    Next
    Next
    _ArraySort($aListe, 0, 0, 0, 0)
    _ArrayDisplay($aListe,0)
    $aListe=""
    EndIf
    EndFunc

    [/autoit]

    Danke für jede Hilfe die Ihr mir leisten könnt...

    Spoiler anzeigen
    Zitat

    Ich weiß wo dein Haus wohnt... 8o

    • Offizieller Beitrag
    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 820, 443, -1, -1)
    $Liste = GUICtrlCreateListView("Pos.|T1|T2|T3|T4|T5|||", 20, 133, 780, 300, BitOR($LVS_REPORT, $LVS_EDITLABELS, $WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE))
    GUICtrlSetResizing(-1, $GUI_DOCKALL)
    _GUICtrlListView_SetColumnWidth($Liste, 0, 130)
    _GUICtrlListView_SetColumnWidth($Liste, 1, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 2, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 3, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 4, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 5, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 6, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 7, 80)
    _GUICtrlListView_SetColumnWidth($Liste, 8, 80)
    _GUICtrlListView_SetExtendedListViewStyle($Liste, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
    GUICtrlCreateListViewItem("A" & "|" & 225 & "|" & 355 & "|" & 400 & "|" & 102 & "|" & 100 & "|" & 50, $Liste)
    GUICtrlCreateListViewItem("B" & "|" & 325 & "|" & 278 & "|" & 400 & "|" & 207 & "|" & 366 & "|" & 50, $Liste)
    GUICtrlCreateListViewItem("C" & "|" & 425 & "|" & 645 & "|" & 500 & "|" & 752 & "|" & 75, $Liste)
    GUICtrlCreateListViewItem("D" & "|" & 225 & "|" & 100 & "|" & 786 & "|" & 400 & "|" & 200 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("E" & "|" & 125 & "|" & 355 & "|" & 900 & "|" & 400 & "|" & 316 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("F" & "|" & 100 & "|" & 355 & "|" & 786 & "|" & 752 & "|" & 30 & "|" & "|" & 530, $Liste)
    GUICtrlCreateListViewItem("G" & "|" & 355 & "|" & 225 & "|" & 120 & "|" & 400 & "|" & 100, $Liste)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $Button = GUICtrlCreateButton("Stückliste", 350, 60, 120, 25)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button
    arraysearch2()
    arraysearch3()
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func arraysearch2()
    Global $aListe[1]
    $iColumn = _GUICtrlListView_GetColumnCount(GUICtrlGetHandle($Liste))
    $iRow = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($Liste))
    If $iRow > 0 Then

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iRow - 1
    For $k = 6 To $iColumn - 2
    $sItem = _GUICtrlListView_GetItemText(GUICtrlGetHandle($Liste), $i, $k)
    For $j = 2 To 2
    $sItem2 = _GUICtrlListView_GetItemText(GUICtrlGetHandle($Liste), $i, $j)

    [/autoit] [autoit][/autoit] [autoit]

    If $sItem <> "" Then
    $iArraySearch = _ArraySearch($aListe, $sItem & $sItem2)
    If $iArraySearch = -1 Then
    ReDim $aListe[UBound($aListe) + 1][4]
    $aListe[UBound($aListe) - 1][0] = Int($sItem2)
    $aListe[UBound($aListe) - 1][1] = 1
    $aListe[UBound($aListe) - 1][2] = Int($sItem)
    $aListe[UBound($aListe) - 1][3] = Int($sItem & $sItem2)
    Else
    $aListe[$iArraySearch][1] += 1
    EndIf
    EndIf
    Next
    Next
    Next
    ReDim $aListe[UBound($aListe)][3]
    _ArraySort($aListe, 0, 0, 0, 0)
    _ArrayDisplay($aListe, 0)
    $aListe = ""

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndFunc ;==>arraysearch2
    Func arraysearch3()
    Global $aListe[1]
    $iColumn = _GUICtrlListView_GetColumnCount(GUICtrlGetHandle($Liste))
    $iRow = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($Liste))
    If $iRow > 0 Then

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iRow - 1
    For $k = 7 To $iColumn - 1
    $sItem = _GUICtrlListView_GetItemText(GUICtrlGetHandle($Liste), $i, $k)
    For $j = 3 To 3
    $sItem2 = _GUICtrlListView_GetItemText(GUICtrlGetHandle($Liste), $i, $j)

    [/autoit] [autoit][/autoit] [autoit]

    If $sItem <> "" Then
    $iArraySearch = _ArraySearch($aListe, $sItem & $sItem2)
    If $iArraySearch = -1 Then
    ReDim $aListe[UBound($aListe) + 1][4]
    $aListe[UBound($aListe) - 1][0] = Int($sItem2)
    $aListe[UBound($aListe) - 1][1] = 1
    $aListe[UBound($aListe) - 1][2] = Int($sItem)
    $aListe[UBound($aListe) - 1][3] = Int($sItem & $sItem2)
    Else
    $aListe[$iArraySearch][1] += 1
    EndIf
    EndIf
    Next
    Next
    Next
    _ArraySort($aListe, 0, 0, 0, 0)
    ReDim $aListe[UBound($aListe)][3]
    _ArrayDisplay($aListe, 0)
    $aListe = ""
    EndIf
    EndFunc ;==>arraysearch3

    [/autoit]
  • So einfach????

    [autoit]

    ReDim ()

    [/autoit]


    Und ich Hirni probier schon ein paar stunden mit For-Schleifen & _ArrayDelete / _Array2dDelete rum.
    Danke Raupi...

    Spoiler anzeigen
    Zitat

    Ich weiß wo dein Haus wohnt... 8o

    • Offizieller Beitrag

    Hättest du auch selber drauf kommen können. Hab ich dir, soweit ich weiß, auch in den komments zu deinem Script beschrieben. Schau dir mal das Array Tut von BugFix an: http://www.bug-fix.info/array_tut.htm :thumbup: