title: CFloop through query and apply each result to a variable
body: <p>I'm drawing a bit of a blank at the moment on looping, so a pointer would be greatly appreciated.</p>
  
  <ol>
  <li><p>I'm running a query for a list of names in a table given before a specific time.</p></li>
  <li><p>I need to loop through those results and set a variable <code>&lt;cfset file2 = (result from query)</code> so this code can execute:</p>
  
  <blockquote>
  <pre><code>&gt;  &lt;cfexecute name="C:\Program Files
  &gt; (x86)\neeviaPDF.com\PDFcompress\cmdLine\CLcompr.exe"
  &gt; arguments="C:\inetpub\wwwroot\testingFolder\PDFCompression2\pdf\#arguments.file2#
  &gt; C:\inetpub\wwwroot\testingFolder\PDFCompression2\pdf\ResultPDF3.pdf
  &gt; -co -ci jpg -cq 10 -gi jpg -gq 10 -mi jbig2 -mq 1" outputfile="C:\inetpub\wwwroot\testingFolder\PDFCompression2\output.txt"
  &gt; timeout="250"&gt; &lt;/cfexecute&gt;
  </code></pre>
  </blockquote></li>
  </ol>
  
  <p>It will then loop through the results of the query setting the variable file2 to each result, thus compressing the files with those names.</p>