_ArraySearch Problem mit 2D Array

  • Hey,

    ich versuche mit _ArraySearch einen Wert in dem Array $data_local aus dem Array $data_online zu suchen. Der Index des Wertes kann in beiden Arrays an unterschiedlicher Stelle stehen. Der Wert kann unter Umständen auch garnicht in $data_local vorhaden sein.

    Die Ausgabe der beiden Arrays und die Fehlermeldung sind auf dem Bild im Anhang zu sehen.

    Wie kann ich


    [autoit]

    Global $data_update[1]
    For $i = 0 To UBound($data_online, 1) -1
    Local $index = _ArraySearch($data_local, $data_online[$i][0], 0, 0, 0, 1, 1, 1)
    If @error Then
    MsgBox(0,"Nicht gefunden", $data_online[$i][2])
    _ArrayAdd($data_update, $data_online[$i][2])
    If @error Then _log('01016')
    EndIf
    If $action = 0 Then ExitLoop
    Next

    [/autoit]

    Wie kann ich überprüfen, ob der Wert in $data_online[$i][0] (Hash-Wert) auch in $data_local vorhanden ist? Der Aufbau der beiden Arrays ist identisch.

  • So?

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>

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

    Global $data_online[4][3] = [[12, "TestA", "bla"], [6, "Neu", "pups"], [45, "TestC", "blablabla"], [754, "TestD", "blablablabla"]]
    Global $data_local[4][3] = [[6, "TestB", "blabla"], [754, "TestD", "blablablabla"], [45, "TestC", "blablabla"], [12, "TestA", "bla"]]
    Global $data_update[1]

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

    For $i = 0 To UBound($data_online) - 1
    Local $index = _ArraySearch($data_local, $data_online[$i][1], 0, 0, 0, 1, 1, 1)
    If @error = 6 Then
    MsgBox(0,"Nicht gefunden", $data_online[$i][2])
    _ArrayAdd($data_update, $data_online[$i][2])
    ;~ If @error Then _log('01016')
    EndIf
    ;~ If $action = 0 Then ExitLoop
    Next

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

    _ArrayDisplay($data_update)

    [/autoit]