> I have the following list from an external file that is being creating
with
> the <cfexecute tag.
> What I would like to do (but not sure how) is to grab the page numbers
from
> the list ONLY and include them in the <select tag.
>
> Here is a snippet from the external file. This could be a few lines or a
> few hundred. Depends on the job.
<snip>
>
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> S U M M A R Y O F F O L I O S / L E A D
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> 001>folio: 165 . . . 011.50 points free
> 002>folio: 166 . . . 007.00 points free
<snip>
Last week I sent an answer to your problem to the list and directly to
you... did you have troubles with my solution? Here it is again:
You can use regular expressions to parse the page number from each line of
the file. Here's the code you'll need:
<!--- read in the file --->
<CFFILE ACTION="READ"
FILE="#TheFolder#\page-results.log"
VARIABLE="sIn">
<!--- create the array of page nums --->
<CFSET arPages = ArrayNew(1)>
<!--- find lines like "001>folio: 165 . . . 011.50 points free" --->
<CFSET strCR = Chr(13) & Chr(10)>
<CFSET reLine = "([0-9]+>folio:[ ]+)([0-9]+)[::Graph::| ]+(#strCR#)?">
<CFSET stcLine = REFindNoCase(reLine, sIn, 1, True)>
<!--- loop through the line matches, pull out the page
number and add it to the array --->
<CFLOOP CONDITION="#stcLine.pos[1]# NEQ 0">
<CFSET strLine = Mid(sIn, stcLine.pos[1], stcLine.len[1])>
<CFSET strPageNum = REReplaceNoCase(strLine, reLine, "\2", "ALL")>
<CFSET result = ArrayAppend(arPages, strPageNum)>
<!--- get the next match --->
<CFSET stcLine = REFindNoCase(reLine, sIn, stcLine.pos[1]+stcLine.len[1]-1,
True)>
</CFLOOP>
<!--- you now have an array of the page numbers (arPages)
from which you can populate your select box --->
<CFOUTPUT>
<select name="filelist" size="5" multiple>
<CFLOOP INDEX="i" FROM="1" TO="#ArrayLen(arPages)#">
<option value="#arPages[i]#">#arPages[i]#</option>
</CFLOOP>
</select>
</CFOUTPUT>
I tested everything except the select box building code on my own machine
using a text file I created from your email. You should be able to copy and
paste the code directly into your application.
Hope this helps,
Seth Petry-Johnson
Argo Enterprise and Associates
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists