RE: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread Charlie Arehart
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.




Re: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread Gavin Baumanis
I realise it is not - in your example but...
If the position of the number s always at the same position in the list;
You can use ListGetAt()

Otherwise you can loop through the list using the regex of the other posts 
to find your match.

Lastly, depending on the length of the CSV, and the lists themselves, you 
don't need to convert to an array first.
There are appropriate functions available to let you process thee data in 
list form.

Array manipulation / searching is faster, though - so I normally convert to 
an Array.
(The speed test also takes into account the transformation from list to 
array and then back again - so it shows there is significant speed gains in 
using Arrays.)

Ultimately, it just depends on how comfortable you are with converting 
between lists to arrays and back again.

Gavin. 

-- 
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.




Re: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread Chris Velevitch
I understand you want to know the column in the record, then do a
ListToArray and loop though each element to look for the pattern, use
"^[0-9]{15}$" to look for value that are exactly 15 chars.

Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
Topic: TBD
Date: Monday, 29th July
Details and RSVP on http://www.meetup.com/Sydney-Adobe-Platform-User-Group

-- 
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.




Re: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread M@ Bourke
then you want a regex like
[0-9]{15}

it'll find a number set 15 numbers long.

Do I understand you better now?
reFindNoCase
should return
868487001009190
then if you want to know the position you could do a listFindNoCase
pseudo code

foundNumber = reFindNoCase("[0-9]{15}", bigString)
position = listFindNoCase(foundNumber , bigString)

these function params could be in the wrong order etc, but is this kind of
what you mean?


On Thu, Jul 4, 2013 at 3:13 PM,  wrote:

>  *Hi *
>
> * *
>
> *I think you misunderstand I will not know what the values of the 15
> character numbers are, that’s the objective finding the 15 character
> numbers to the ne able to determine what the actual number value is which
> will be different for each record*
>
> * *
>
> ** **
>
> ** **
>
> Kind Regards
>
> ** **
>
> Claude Raiola
>
> SAMARIS Software
>
> Call 1300 255 990
>
> * *
>
> *From:* cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] *On
> Behalf Of *M@ Bourke
> *Sent:* Friday, 5 July 2013 12:03 AM
> *To:* cfaussie@googlegroups.com
> *Subject:* Re: [cfaussie] string manipulation to find the value in a
> comma separated value record set of a specific length and syntax
>
> ** **
>
> ListFindNoCase()  ??
>
> On Thu, Jul 4, 2013 at 2:35 PM,  wrote:
>
> 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.471336,20130704121354,0505,0002,1B8D,A281,00,006064939682,-66,20130704122355,0758$'
> 
>
>  
>
> record 2: '+RESP:GTTRI,
> 868487001009190,1,0,0,0,0.2,148,6.4,3,153.034551,-27.471390,20130610110953,0505,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.
>
>  
>
> --
> 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.




RE: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread raiola
Hi 

 

I think you misunderstand I will not know what the values of the 15
character numbers are, that's the objective finding the 15 character numbers
to the ne able to determine what the actual number value is which will be
different for each record

 

 

 

Kind Regards

 

Claude Raiola

SAMARIS Software

Call 1300 255 990

 

From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf
Of M@ Bourke
Sent: Friday, 5 July 2013 12:03 AM
To: cfaussie@googlegroups.com
Subject: Re: [cfaussie] string manipulation to find the value in a comma
separated value record set of a specific length and syntax

 

ListFindNoCase()  ??

On Thu, Jul 4, 2013 at 2:35 PM,  wrote:

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.
 
 

-- 
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.




Re: [cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread M@ Bourke
ListFindNoCase()  ??

On Thu, Jul 4, 2013 at 2:35 PM,  wrote:

>  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.471336,20130704121354,0505,0002,1B8D,A281,00,006064939682,-66,20130704122355,0758$'
> 
>
> ** **
>
> record 2: '+RESP:GTTRI,
> 868487001009190,1,0,0,0,0.2,148,6.4,3,153.034551,-27.471390,20130610110953,0505,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.




[cfaussie] string manipulation to find the value in a comma separated value record set of a specific length and syntax

2013-07-04 Thread raiola
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.