- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I want to do a component replace operation and want to give user a choice of using the next available file or previous available file if reqd file is not available in network folder. To do this my idea is as follows,
- Create an array list of all part files available in search location (network folder)
- Display the name of all files in a single msg box. This is just a check to see if the array list has all the files.
- Compare the given file name (required file) with file names in arraylist.
- If file name in array list is greater than given file name, add those names to new arraylist.
- If file name in array list is smaller than given file name, add those names to another new arraylist.
Basically array list in step 4 & 5 are the sub set of array list created in step 1. At this point there should be 3 array lists in total.
6. Get the file name which has the smallest bolt length (in their name) from array list in step 4 and ask user if they want to use this file to do component replace. If yes, proceed and if No then Step 7.
7. Get the file name which has the highest bolt length (in their name) from array list in step 5 and ask user if they want to use this file to do component replace. If yes, proceed and if No then just display a msg saying "No file Replaced" and exit code.
Can anybody help to write the code to accomplish this?
Given File name format: FN = "ISO 4014 - " & BOLT_DESIG & "ISO.ipt"
Where BOLT_DESIG is an inventor parameter with values like M12 x 210. M12 is the dia of the bolt and 210 is bolt length.
Given file name example. FN = "ISO 4014 – M12 x 210 ISO.ipt"
Example:
Suppose network folder has following files in it.
ISO 4014 – M8 x 100 ISO.ipt
ISO 4014 – M8 x 210 ISO.ipt
ISO 4014 – M12 x 100 ISO.ipt
ISO 4014 – M12 x 150 ISO.ipt
ISO 4014 – M12 x 220 ISO.ipt
ISO 4014 – M12 x 240 ISO.ipt
ISO 4014 – M16 x 200 ISO.ipt
ISO 4014 – M16 x 220 ISO.ipt
Now as you can see the given file name "ISO 4014 – M12 x 210 ISO.ipt" is not available. So the code should ask user if they want to use “ISO 4014 – M12 x 220 ISO.ipt” to do replace component as result of step 6.
If no then code should ask if they want to use “ISO 4014 – M12 x 150 ISO.ipt” to do replace component as result of step 7.
As per this example, the array list in step 4 will have following entries.
ISO 4014 – M12 x 220 ISO.ipt
ISO 4014 – M12 x 240 ISO.ipt
The array list in step 5 will have following entries.
ISO 4014 – M12 x 100 ISO.ipt
ISO 4014 – M12 x 150 ISO.ipt
I hope it makes it clear what the goal is.
I have done step 1 as follows but I am stuck after that.
Dim fullfilelist As New ArrayList Dim SearchLocation As String = "\\BG-DOC1\am\Vault,D-Comtec\CONTENT CENTRE FILES\en-US\ISO 4014(2)\" Dim File As String Dim filename As String() filename = System.IO.Directory.GetFiles(SearchLocation, "*.ipt") For Each File In SearchLocation
fullfilelist.Add(File) Next
A very humble thank you in advance for all of your help.
Solved! Go to Solution.