# List working with the IF...Then process

**URL:** https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664
**Category:** Discussion
**Created:** [November 20, 2007, 2:26am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664 "2007-11-20T02:26:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [November 20, 2007, 2:26am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/1 "2007-11-20T02:26:14Z")

</div>

Is there a way to add a List Iterate to the IF then.&nbsp; It works to some extent.&nbsp; Here is what I am doing

I am Iterating through all the folders to a network location.&nbsp; I will then check to see if that folder is part of an exlcusion list.&nbsp; If it is not then I will check the date time of the folder to see if it matches a date time comparison&nbsp;and if it matches I will perform a copy of it to another location.

Right now I&nbsp;have a Folder iterator with and If...Then&nbsp;with Many expressions.&nbsp; I would like to only have one expression to a list!&nbsp; and have it check that and then if it is not found on&nbsp;the list perform the functions stated above.

&nbsp;

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [November 20, 2007, 11:07am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/2 "2007-11-20T11:07:07Z")

</div>

Hi Dennis,   
  
Thanks for your post. In recent FB 5.5 builds (definitely in the latest official build) there are two new comparison types - "Is substring of" and "Is member of comma-separated list". There are also two converse comparisons (is NOT substring.../is NOT member...)  
  
Would any of these do the job for you?

Regards,   
  
Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [November 21, 2007, 8:31am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/3 "2007-11-21T08:31:10Z")

</div>

Another way to do it is to set a variable like %Exclude% to “no”, then do a list iterator over your exclusion list, that contains an IF … THEN that checks to see if the folder matches the iteration variable, and if so, sets %Exclude% to “yes”. After the list iterator is done, you check the value of %Exclude%, and if the folder matched anything on your exclusion list, it will be set to “yes”.   
  
 It will be a lot slower tham using the comparisons that Angus mentioned, but if those won’t work in your case, this method can probably be made to work.   
  
 Keith

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [December 12, 2007, 5:37am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/4 "2007-12-12T05:37:20Z")

</div>

Keith,

Thanks, for the feedback I will see if this works for us, but slowness does hinder us with our applications.&nbsp; Our applications are quite lengthy and just to build 1 of the packages out of 20 packages could take 4 hours to build.&nbsp; so where speed is a virtue, I try to expediate where I can.&nbsp;

&nbsp;

Right now if I coded in vbscript.&nbsp; my build for the projects took 2 hours total.&nbsp; if file additions and deletes the over all time went to 4 hours.&nbsp;

&nbsp;

Currently with FInalbuilder we have increased the time by 1-2 hours more.

&nbsp;

The one projects where speed is critical increased by 35 minutes using finalbuilder.&nbsp;

I use part of the time increase to the use of finalbuilder instead of the vbscripts we used to use.

&nbsp;

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [December 12, 2007, 11:25am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/5 "2007-12-12T11:25:37Z")

</div>

Hi Dennis,   
  
 You may be right about slowness, although there are other benefits from FB (like full hierarchical logging.) Some suggestions for improving speed are:   
  
 - Use FBCMD instead of the IDE to run builds   
  
 - Use FBCMD with the /S option to disable writing to the FinalBuilder log file, if you don’t need it.   
  
 - Use VBScript and the Run Script action to recode any “tight loop” sections of your project, if you absolutely need performance (an example of a “tight loop” would be an iterator with just one or two children, doing several thousand iterations.)   
  
 - Upgrade to the next major version of FB when it comes available, because performance improvements are a priority for that version. :-).   
  
 Regards,   
  
  
 Angus

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [December 19, 2007, 2:07am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/6 "2007-12-19T02:07:37Z")

</div>

We are using FBCMD instead of IDE. We log the run with export at the end, will the /S cause issues there. Overall I have it down to adding only 1 hour extra for the total time with Finalbuilder.   
 This is comparison to running via Vbscripts. with the same build process. The oen area that seems to increase the time is when we have a iterate to Robocopy or the other is the comparison we have to do to strip away files that already are part of another package.

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [December 19, 2007, 11:01am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/7 "2007-12-19T11:01:47Z")

</div>

Hi Dennis,   
  
If you need Export Log then unfortunately you can't use /S.

The slower operations you describe are the kind of thing we are concentating on optimising intensely for the next major release of FB. It will never be as fast as dedicated script, though, because of the overhead of logging.  
  
Another possibility that I forgot to mention last week is to use Async Action Groups to run some portions of your build in parallel. For many operations, this will dramatically cut down the build time.   
  
Regards,   
  
Angus

---

<div class="post-metadata">

### Author: ![djmarks](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/b487fb/32.png) [@djmarks](https://www.finalbuilder.com/forums/u/djmarks)
#### Post date: [December 21, 2007, 1:46am UTC](https://www.finalbuilder.com/forums/t/list-working-with-the-if-then-process/664/8 "2007-12-21T01:46:20Z")

</div>

Angus,   
  
 Thanks, Async Action will not work since most are dependent on a previous action to run For example, Once our Binaries are compiled,   
  
 I run:   
 Sync fileset,   
 Build Package   
 Deploy Package   
 Create Media.   
  
 As you can tell each one depends on the previous to finish. The area that is mostly the slow area is the Sync Fileset.   
  
 Here is a script i used a long time ago and this worked well. I compared files and removed from the one compare location.   
  
  
  
  
 '--------------------------------------------------------------------   
 'SubFilesComp - Compare Source files to Local Files   
 '--------------------------------------------------------------------   
 Sub SubFilesComp(StrSourceFolder,strDestFolder,strProcess,DicName,FlagSet,ItemsList)   
 On Error Resume Next   
  
 Dim s, strCurrentFolder, fsofile, sArray, t, FileNameOnly   
 Dim objFile, objFile1   
 Dim NewFileCount, DeletedFileCount, OutSyncCount   
  
 Set DeleteDictionary = CreateObject(“Scripting.Dictionary”)   
 DeleteDictionary.CompareMode= VBTextMode   
  
 ’ Parameters used when counting items found.   
 NewFileCount=0   
 DeletedFileCount=0   
 OutSyncCount=0   
  
 For s = 0 to DicName.Count-1   
 'Convert Source location to Destination Folder   
 strCurrentFolder = Replace(LCase(ItemsList(s)),LCase(StrSourceFolder),LCase(strDestFolder))   
 For Each fsoFile In oFileSystem.GetFolder(ItemsList(s)).Files   
 sArray =Split(fsoFile, “”)   
 t =UBound(sArray)   
 FileNameOnly =sArray(t)   
 ’ Comparing Source and Destimation locations files   
 Select Case strProcess   
 Case “Delete”   
 If oFileSystem.FileExists(strCurrentFolder & “”& FileNameOnly) Then   
 DeleteFile (strCurrentFolder & “”& FileNameOnly): CheckError (“Delete File Add: " & strCurrentFolder & “”& FileNameOnly & " Failed.”)   
 Else   
 message=VBCRLF & strCurrentFolder & “”& FileNameOnly & VBCRLF & " does not exsit."   
 n=writeafile(logfile,message)   
 End If   
 Case “NoDelete”   
 Select Case FlagSet   
 Case “New2LastBuild”   
 If Not oFileSystem.FileExists(strCurrentFolder & “”& FileNameOnly) Then   
 DeletedFileCount = DeletedFileCount + 1   
 message=VBCRLF & "File has Been Deleted: "& fsoFile & “.”   
 n=writeafile(DeletedFileLog,message)   
 Else   
 Set objFile = oFileSystem.GetFile(fsoFile)   
 Set objFile1 = oFileSystem.GetFile(strCurrentFolder & “”& FileNameOnly)   
  
 If objFile1.DateLastModified \<\> objFile.DateLastModified Then   
 OutSyncCount= OutSyncCount + 1   
 message=VBCRLF & “Files Out of Sync:” & VBCRLF & \_   
 objFile1.Path & " , " & objFile1.DateLastModified & \_   
 VBCRLF & objFile.Path & " , " & objFile.DateLastModified & “.”   
 n=writeafile(OutSynclog,message)   
 End If   
 End If   
 Case “LastBuild2New”   
 If Not oFileSystem.FileExists(strCurrentFolder & “”& FileNameOnly) Then   
 NewFileCount= NewFileCount + 1   
 message= VBCRLF & "File is new: "& fsoFile & “.”   
 n=writeafile(NewFileLog,message)   
 Else   
 Set objFile =oFileSystem.GetFile(fsoFile)   
 Set objFile1 =oFileSystem.GetFile(strCurrentFolder & “”& FileNameOnly)   
  
 If objFile1.DateLastModified \<\> objFile.DateLastModified Then   
 OutSyncCount= OutSyncCount + 1   
 message=VBCRLF & “Files Out of Sync:” & VBCRLF & \_   
 objFile1.Path & " , " & objFile1.DateLastModified & \_   
 VBCRLF & objFile.Path & " , " & objFile.DateLastModified & “.”   
 n=writeafile(OutSynclog,message)   
 End If   
 End If   
 Case Else   
 message=VBCRLF & “No Changes” & VBCRLF & fsoFile & “.”   
 n=writeafile(logfile,message)   
 End Select   
 End Select   
 Next   
 Next
