Copy data based on field value

Discussion created by keags1 on Sep 30, 2011
Latest reply on Oct 4, 2011 by jamesfreddyc

I have been using the code below to copy images from one folder to another.
This code uses a tablesort to select the highest value in a field to determine which files are copied:

       pTableSort = New TableSort
        With pTableSort
            pTableSort.SelectionSet = pFSel.SelectionSet
            .Fields = sFieldName1
            .Ascending(sFieldName1) = False
            .QueryFilter = Nothing
        End With

        Dim i As Integer

        Dim pCursor As ICursor
        pCursor = pTableSort.Rows
        Dim pRow As IRow
        pRow = pCursor.NextRow
        Dim pValue As String

        pValue = pRow.Value(pFLayer.FeatureClass.FindField(sFieldName1))

        If pValue = 10000 Then
            FileCopy(FolderToCopyFrom & "\" & CStr("Fepa_Example.jpg"), FolderToCopyTo & "\" & CStr("Fepa_Example.jpg"))

...and so on

This code works perfectly for what I have needed it to do.
I am now looking to modify it to look through the whole field and then copy a file based on an occurence of a value.

IE - I now want to search the table for potentially 3 predetermined values and copy the relevant file as has been done in the past.

Any ideas?

I am using ArcInfo 10 and VB.Net.