Jump to content

Interesting array question


Go to solution Solved by FireFox,

Recommended Posts

Ok..

Thanks again FF for the code.

I have made some enhancements(whether they are coded correctly or optimally is another thing).

  • Created addition preview/output columns
  • Added output file name input requirement
  • Allowed multiple search criteria
  • Annotated the controls

 

One of the requirements I'm having difficulty with is preventing duplicate rows from being input to the preview.

I've tried all sorts of listview to array examples from the forums to achieve this but am getting nowhere.

Basically, when the commit button is clicked there should be a check to see if a row in the Segments list view already exists in the Preview list view and if there is the commit is stopped and the user informed of the offending row so they can do something.

 

After days of  f'ing about with arrays I finally solved it with a simple function. :sweating:

Func _Dupes()

    Local $iSeg, $iPvw

    ;Get the segment 'buyer' value
    For $k = 0 To _GUICtrlListView_GetItemCount($hLwSegments) - 1
        $iSeg = _GUICtrlListView_GetItemText($hLwSegments, $k, 2)

        ;Get the preview 'buyer' value
        For $m = 0 To _GUICtrlListView_GetItemCount($hLwPreview) - 1
            $iPvw = _GUICtrlListView_GetItemText($hLwPreview, $m, 3)

            If $iPvw == $iSeg Then
                ConsoleWrite("Duplicate found = " & $iPvw & @CRLF)
                $cRetval = 1
            EndIf
        Next
    Next

    Return $cRetval

EndFunc   ;==>_Dupes
Link to comment
Share on other sites

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...