itself loops sequentially, maybe there's a gain to be had by using a
native function rather than a hand-crafted loop, but I dunno. It'd be
easy to benchmark, anyway.
(On second thought, ReplaceList is implicitly scoped to "all," which
seems inefficient in this case, and my whole idea is probably crap.
;-)
// String with placeholders
inStr = "Your name is {firstName} {midInit} {lastName}";
// Placeholders
varNameList = "{firstName},{midInit},{lastName}";
// Replacement Values
varValLis = "#q.firstName#,#q.midInit#,#q.lastName#";
// Perform replacement
outStr = ReplaceList(inStr, varNameList, varValList);
Jamie
On Tue, 10 Feb 2004 16:24:22 -0700, in cf-talk you wrote:
>We have a case where we have 30+ instances of text in an RTF document that need to be replaced with specific database values. The routine we have does work, but it's pretty slow. In one case, we have a 1+ meg file, that we need to do the 30 replacements on via the REPLACENOCASE function. This file is taking approx 3-5 minutes to open. We've explored using REREPLACE instead, but are not seeing any noticable speed improvement.
>
>The algorithm we have is something like so:
>
>1. read file into a memory variable via the CFFile tag with action=""> >2. Loop through our elements to replace
>3. do an replace on the file in memory for the current element
>4. End loop
>5. Write the new file out to a temporary file (which we manage through another process).
>
>We've used the GetTickCount function to narrow down exactly where the delay is, and it's in the loop - not on the read and write commands.
>
>I'm sure there's a better way to do this - we're looking for a sub 10 second response time, if possible. Any suggestions?
>
>Shawn
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

