Do you need to pass it like this or can you transform the list on the
server to make the ranges? Is the list always in numerical order?

> -----Original Message-----
> From: Nathan R. Jessop [mailto:[EMAIL PROTECTED]
> Sent: woensdag 19 mei 2004 17:00
> To: CF-Talk
> Subject: re: Arrange sequential selections into ranges how to???
>
> Hi,
>
> I'm reading in an external file and then passing the results
> to my action page by selecting all or individual selections.
>
> This is what the listing would like from the file I'm reading
> in (which is generated by a another program).
>
> 001>folio:  2201 . . . 274.00 points free
> 002>folio:  2251 . . . 021.00 points free
> 003>folio:  2252 . . . 001.00 points free
> 004>folio:  2253 . . . 011.00 points free
> 005>folio:  2254 . . . 001.00 points free
> 006>folio:  2255 . . . 001.00 points free
> 007>folio:  2256 . . . 213.00 points free
> 008>folio:  2301 . . . 412.00 points free
> 009>folio:  2305 . . . 202.00 points free
> 010>folio:  2311 . . . 009.00 points free
> 011>folio:  2312 . . . 003.00 points free
> 012>folio:  2313 . . . 000.50 points free
> 013>folio:  2314 . . . 006.50 points free
> 014>folio:  2315 . . . 321.50 points free
> 015>folio:  2317 . . . 008.00 points free
> 016>folio:  2318 . . . 006.50 points free
> 017>folio:  2319 . . . 230.50 points free
> 018>folio:  2325 . . . 000.00 points free
> 019>folio:  2326 . . . 001.00 points free
> 020>folio:  2327 . . . 202.50 points free
> 021>folio:  2335 . . . 007.00 points free
> 022>folio:  2336 . . . 012.00 points free
> 023>folio:  2337 . . . 001.50 points free
> 024>folio:  2338 . . . 010.00 points free
> 025>folio:  2339 . . . 004.00 points free
> 026>folio:  2340 . . . 012.50 points free
> 027>folio:  2341 . . . 001.50 points free
> 028>folio:  2342 . . . 007.50 points free
> 029>folio:  2343 . . . 001.50 points free
> 030>folio:  2344 . . . 007.50 points free
> 031>folio:  2345 . . . 022.00 points free
>
> I then loop through the file and display the results in a <select>.
>
>
> It would display something like this:
>
> Seq: 1 Folio: 2201
> Seq: 2 Folio: 2202
> Seq: 3 Folio: 2203
> Seq: 4 Folio: 2204
> Seq: 5 Folio: 2205
> Seq: 6 Folio: 2206
> Seq: 7 Folio: 2207
> ...and so on...
>
>
> From here the user can select all the pages or individual
> selections using the Shift or Ctrl keys. The results are
> passed to my action page as a comma delimiited list
> (variable) and fed into the program. At times the user
> selsection can be VERY large and the program barfs because it
> can't handle such a large string.
>
> So this is my question. How can I arrange sequential
> selections into ranges. Meaning is a user selects the first
> 50 pages. Currently when the selection gets passed to my
> action page the results would be:
>
> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
> ,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,4
> 5,46,47,48,49,50
>
> How can I make the above get passed as:
>
> 1-50?
>
> and if the selection happended to be:
>
> 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,23,24,25,30,33,40,41,42
> ,46,47,48
>
> How can I make the above get passed as this:
>
> 1-16,23-25,30,33,40-42,46-48
>
> The below code generate the listing like:
>
> Seq: 1 Folio: 2201
> Seq: 2 Folio: 2202
> Seq: 3 Folio: 2203
> Seq: 4 Folio: 2204
> Seq: 5 Folio: 2205
> Seq: 6 Folio: 2206
> Seq: 7 Folio: 2207
> ...and so on...
>
> <select name="filelist" size="15" multiple class="dirlinks">
>
> <cfloop INDEX="i" FROM="1" TO="#ArrayLen(arPages)#">
>
> <cfset sVal = Trim(ListFirst(arPages[i], ">"))>
>
> <cfset sDisp = Trim(ListLast(arPages[i], ">"))>
>
> <cfset sValNoComma = NumberFormat(sVal, "9999999999")>
>
> <cfset sVal = NumberFormat(sVal)>
>
> <option value="#sValNoComma#">Seq:
> #sValNoComma#&nbsp;&nbsp;Folio: #sDisp##spacer1#</option>
>
> </cfloop>
>
> </select>
>
>
>
>
>
>
>
> ---------------------------------------------------
> Colonel Nathan R. Jessop
> Commanding Officer
> Marine Ground Forces
> Guatanamo Bay, Cuba
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to