Parsing file in freemarker

240 views
Skip to first unread message

J.M

unread,
Nov 2, 2016, 8:08:22 AM11/2/16
to Fujitsu RunMyProcess Developer Community
Hi team,


I have a little question for you about freemarker. I'm reading a file, and storing its content in an array in which each coordinate is a line of my file.

But now I need to parse the conntent of the line taking values using their positions (not separator).

The read of the file is correct (It was provided by RMP Team in another post).

My array is as follows (copied from the process variable, once has been launched):
[
"18800456015343421603 20161017000000.020161009000000.0ESBM GD ","18800903075348050303 20161017000000.020161009000000.0ESBM GD ","18802255029258431503 20161017000000.020161009000000.0ESBM GD ","18802366085263411503 20161017000000.020161009000000.0ESBM GD ","18802469042263600403 20161017000000.020161009000000.0ESBM GD ","18802572002265410403 20161017000000.020161009000000.0ESBM GD ","18802697058257730403 20161017000000.020161009000000.0ESBM GD ","18802824022704008202 20161017000000.020161014000000.0ESBS0641GD ","18802965021266720403 20161017000000.020161009000000.0ESBM GD ","18802994011267161103 20161017000000.020161009000000.0ESBM GD ","18810698084345521503 20161017000000.020161009000000.0ESBM GD ","18810926072778520403 20161017000000.020161009000000.0ESBM GD ","18812260074263661603 20161017000000.020161009000000.0ESBM GD ","18812273066253750403 20161017000000.020161009000000.0ESBM GD ","18812428092268230303 20161017000000.020161009000000.0ESBM GD ","18812627088257880403 20161017000000.020161009000000.0ESBM GD ","18812689048258890403 20161017000000.020161009000000.0ESBM GD ","18812802099253760403 20161017000000.020161009000000.0ESBM GD ","18812806030266691503 20161017000000.020161009000000.0ESBM GD ","18812844079255011503 20161017000000.020161009000000.0ESBM GD ","18812870099257760403 20161017000000.020161009000000.0ESBM GD ","18812873039253551603 20161017000000.020161009000000.0ESBM GD ","18812941011266750403 20161017000000.020161009000000.0ESBM GD ","18820267019765851503 20161017000000.020161009000000.0ESBM GD ","18820406008348220303 20161017000000.02016100900000...
]


The script I'm using is like this:
<#list cont_file as linea>
${linea}
<#assign registro>
{"numTarjeta":"${linea[0..19]}", "fechaSalida":"${linea[25..40]}", "fechaEntrada":"${linea[41..56]}", "codigo":"${linea[57..60]}", "sucursal":"${linea[61..64]}", "tipo" :"${linea[65..66]}"}
</#assign>
${registro}
<#assign guardaObjeto = save_object(registro,"Testing")>
</#list>

The problem is in the debug console of my task, the code is correct and works fine, however when I launch the process I get the following error:
2016-11-02T11:55:58+0000 - Task "procesar fichero" (id: 4[0] - status: ABORTED): Error while processing codeFM
on line 4, column 74 in procesar fichero
Right side of range out of bounds, is: 19
but string is only 0 characters.

I think the error is saying the line has 0 characters, but the array written above, is showing that's not true



What's happening?
How can I parse the content of a file by position number?


Thaks in advance and regards.

Murali

unread,
Nov 3, 2016, 7:30:22 AM11/3/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi Javier,

As per the error message, it seems that variable "codeFM" is not available for the 4th step of your process. (and is not part of the above code)
Please refer to the "Parameters" tab in failed process instance to fix the configuration of the Input/Output variables.

And for the range related error, validate the stored value to adjust accordingly.

Regards,
Murali
Fujitsu RunMyProcess Support




Reply all
Reply to author
Forward
0 new messages