Hello and thanks for your help.

I manage to proceed with a file counting 6 fix entries for each row, separated by comma (;).
But I can't proceed with variable entries...

<!--- I use <cffile> tag to read my txt file and declare an array to put each entry --->
<cffile action=""
file="#expandPath('.')#\T128.TXT" variable="message">
<cfset file_array = ArrayNew(1)>
<cfloop index="rc" list="#message#" delimiters=",#chr(10)#">
<cfset rc = ArrayAppend(file_array, rc)>
</cfloop>

<!---I set the starting record, skipping the first 6 that are 'fixed'--->
<cfset a = 7>
<cfset b = 8>
<cfset c = 9>
<cfset d = 10>
<cfset e = 11>
<cfset f = 12>
<cfset g = 13>
<cfset h = 14>
<cfset i = 15>

<!---Get the record count and subtract 1 to skip the first row--->
<cfset loop_end = (#arrayLen(file_array)#/6)-1>

<!---Then I loop through the records displaying 6 at a time which makes up one row of data but I don't treat variables entries--->
<cfloop index="i" from="1" to="#loop_end#">
<cfoutput>
<hr width="200" align="left">
Record Number: #i<br>
Date: #file_array[a]#<br>
Code: #file_array[b]#<br>
Lib: #file_array[c]#<br>
Value1: #file_array[d]#<br>
Value2: #file_array[e]#<br>
Value3: #file_array[f]#<br>
Name: #file_array[g]#<br>
First Name: #file_array[h]#<br>
Value: #file_array[i]#<br>
</cfoutput>
<cfset a = a + 6>
<cfset b = b + 6>
<cfset c = c + 6>
<cfset d = d + 6>
<cfset e = e + 6>
<cfset f = f + 6>
<cfset g = g + 6>
<cfset h = h + 6>
<cfset i = i + 6>
</cfloop>

Instead of getting

_______________
Record Number 1
13/01/2004 11:36
345
London
00000025
00000415
00000012
SMITH
Deborah
00000085

_______________
Record Number 2
13/01/2004 11:36
202
Paris
00000144
00000002
00000711
CLIFTON
Jack
00000055
COLLINS
Jenifer
00000033

_______________
Record Number 3
13/01/2004 11:36
711
TOKYO
00000125
00000075
00000102
PAUL
Sean
00000077
BOSTON
Mickael
00000114
CHRIS
Helen
00000072

I get

_______________
Record Number 1
13/01/2004 11:36
345
London
00000025
00000415
00000012
SMITH
Deborah
00000085

_______________
Record Number 2
13/01/2004 11:36
202
Paris
00000144
00000002
00000711
CLIFTON
Jack
00000055


_______________
Record Number 3
COLLINS
Jenifer
00000033
13/01/2004 11:36
711
TOKYO
00000125
00000075
00000102

So it's impossible for me after that to request and try to calculate for instance the sum of value1+value2+value3
and other stuff like that...

What would you suggest me to do ?
May be counting the number of entries for the longer row and write blank records in shorter rows before proceeding the file ?
I don't really know what to do.

It would be nice if you have ideas to improve my script.
Thanks a lot.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to