> How would I populate the below selection box using a input file that I > generate from my <cfexecute command? > All I require in the selection box would be the page numbers "165, > 166..etc". Everything else I want to throw out. > > Here is the contents of the file: > > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > 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>
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="YourTextFile.txt" 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 ---> Hope this helps, Seth Petry-Johnson Argo Enterprise and Associates ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm 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

