Thank Paul

 

I have it sorted

 

Its possibly not the cleanest way but it works

 

<cfset imei_pos = reFindNoCase("[0-9]{15}", raw)>

<cfset before_imei =left(raw,imei_pos)>

<cfset comma_count = listlen(before_imei)> 

<cfset imei = ListGetAt(raw,comma_count,",")>

 

 

 

Kind Regards

 

Claude Raiola

SAMARIS Software

Call 1300 255 990

 

From: Paul Kukiel [mailto:[email protected]] 
Sent: Sunday, 7 July 2013 6:35 PM
To: [email protected]
Subject: Re: [cfaussie] string manipulation to find the value in a comma 
separated value record set of a specific length and syntax

 

If you send me a few samples perhaps I can help?

Paul Kukiel | CTO

IMG Sports Technology Group

600 Victoria Street

Richmond 3121

Victoria Australia

P +61 3 9426 2600

M +61 (0) 403 218 804

[email protected]

http://www.imgstg.com


On 07/07/2013, at 4:09 PM, <[email protected]> wrote:

Hi Charlie

 

I trust the following will clear up any confusion

 

I have data from mobile devices being sent to my server

 

The listener captures the packet as a record in database table and the content 
of the packet is stored in a column the database table. This table become my 
raw data / log table of all incoming data

 

I then need to run a process to determine the value of the imei number that is 
included in each packet of data (the packet data is csv string format), the 
imei number tells me which device the data has been sent from.

 

The issue is that different packets received from different devices have their 
imei number located in different positions within the packet data being sent

 

Given each imei number is of a set length ( 15 characters ) and only contains 
numeric characters of 0-9 I am trying to determine the best way to find the 
value of the imei number in each packet received given the position in the 
string will not always be at the same location within the string 

 

 

 

 

Kind Regards

 

Claude Raiola

SAMARIS Software

Call 1300 255 990

 

From: [email protected] [mailto:[email protected]] On Behalf Of 
Charlie Arehart
Sent: Friday, 5 July 2013 8:44 AM
To: [email protected]
Subject: RE: [cfaussie] string manipulation to find the value in a comma 
separated value record set of a specific length and syntax

 

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/WSc3ff6d0ea77859461172e0811cbec1529c-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/WSc3ff6d0ea77859461172e0811cbec22c24-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/WSc3ff6d0ea77859461172e0811cbec0e4fd-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: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Thursday, July 04, 2013 9:35 AM
To: [email protected]
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.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 [email protected].
To post to this group, send email to [email protected].
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 [email protected].
To post to this group, send email to [email protected].
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 [email protected].
To post to this group, send email to [email protected].
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 [email protected].
To post to this group, send email to [email protected].
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