Claude, you don't mention how you are reading the csv in, in the first
place. Are you using CFFILE or another function to read the entire file in,
and then trying to loop over it?

Have you instead tried using CFHTTP? Many don't know it but that has long
had the ability to read in a CSV and convert it to a query (created using
the NAME attribute). Once done, you can easily access the rows and columns,
including using SQL to do a query of queries, to do filtering or other
manipulation. (If you already know of this use of CFHTTP, had you had any
luck in using Q of Q to do the manipulation you seek?)

The only challenge with using CFHTTP for this is that the CSV file in
question does need to be in a web-accessible directory, as you still have to
use a URL to point to the CSV. But if that's not an issue or can be
resolved, you may be surprised the power if you've never seen/used it. 

The tag has a few attributes to control things like whether the first line
has a header row, what delimiter and qualifier to use (if other than a comma
and double-quotes), and more.


The feature is documented in Developer's guide:

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172
e0811cbec1529c-7fff.html

While it's mentioned in the CFML Reference page for CFHTTP, curiously the
key attributes for this capability are not mentioned in the initial table of
attributes (as seems more typical). Instead, they are listed in a separate
table down the page (search for the text, "convert the HTTP response body
into a ColdFusion query object", as there is no section header for it):

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e08
11cbec22c24-7ffc.html

Finally, here's an example that shows both reading a CSV and processing it
with Q of Q (it's listed oddly in a section on using the Cast function for Q
of Q):

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172
e0811cbec0e4fd-7ff0.html#WSc3ff6d0ea77859461172e0811cbec22c24-7b7b

Hope that helps someone, even if not you, Claude. But if it does not, what
aspect still fails to be resolved? It wasn't quite clear from your note (or
your subsequent replies to others here).

/charlie

 

From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf
Of rai...@ozemail.com.au
Sent: Thursday, July 04, 2013 9:35 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] string manipulation to find the value in a comma
separated value record set of a specific length and syntax

 

Hi

 

I have a csv data set with each record contains a set of comma separated
values

 

I am trying to write cf code to interrogate each record to find the value in
the set of comma seated values that meets a specific character set

 

In the examples below you can see the value 868487001009190 is located in
position 3 of the first record and position 2 in the second record

 

Record 1:
'+RESP:GTSTT,070106,868487001009190,GT500,41,0,0.0,0,14.7,153.035960,-27.471
336,20130704121354,0505,0002,1B8D,A281,00,006064939682,-66,20130704122355,07
58$'

 

record 2: '+RESP:GTTRI,
868487001009190,1,0,0,0,0.2,148,6.4,3,153.034551,-27.471390,20130610110953,0
505,0002,1B6B,A281,00,0012,0103090402'

 

 

 

Kind Regards

 

Claude Raiola

SAMARIS Software

Call 1300 255 990

 

-- 
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to