Transformation Language for Reformat

Hi,

I am using the reformat transformation application within clover.

I am trying to convert a string to an integer using the str2num functionality within clover and getting the following message when running.

17:57:35,302 ERROR [WatchDog] - REFORMAT1 …FAILED !
Transformation code is not compilable.
reason: Error(s) when compiling: C:\DOCUME~1\mmeisels\LOCALS~1\Temp\TransformTransformREFORMAT1.java
C:\DOCUME~1\mmeisels\LOCALS~1\Temp\TransformTransformREFORMAT1.java:274: cannot find symbol
symbol : method str2num(java.lang.String)
location: class TransformTransformREFORMAT1
int gender = str2num((inputRecords[0].getField(IN0_IDNUMBERSAIDNUMBER).toString()).substring(7,9));
^
1 error

at org.jetel.component.RecordTransformFactory.loadClassDynamic(RecordTransformFactory.java:205)
at org.jetel.component.RecordTransformFactory.loadClassDynamic(RecordTransformFactory.java:185)
at org.jetel.component.RecordTransformFactory.createTransform(RecordTransformFactory.java:84)
at org.jetel.component.Reformat.init(Reformat.java:236)
at org.jetel.graph.Phase.init(Phase.java:161)
at org.jetel.graph.runtime.WatchDog.executePhase(WatchDog.java:562)
at org.jetel.graph.runtime.WatchDog.run(WatchDog.java:164)
17:57:35,316 ERROR [WatchDog] - !!! Phase finished with error - stopping graph run !!!

My Code is quite simple…

int gender = str2num(${in.0.IDNumbersaidnumber}.substring(7,9));
if ((gender) < 500)
${out.0.IDNumbergender} = “M”;
else
${out.0.IDNumbergender} = “F”;

Is my code wrong?

The clover website looks to say my code is ok… can you see anything please.

http://wiki.clovergui.net/doku.php?id=t … ns#str2num

Any help would be good ta.

dont worry.

Think I found it.

If you use Integer.parseInt instead of str2num it works.

Hi,
function str2num is part of Transformation Language, not Lite Transformation Language. The last one should be used for simple mappings only. If you write transformation using Transformation Language you need to give it into the body of transform function:
function transform(){
nt gender = str2num(${in.0.IDNumbersaidnumber}.substring(7,9));
f ((gender) < 500)
${out.0.IDNumbergender} = “M”;
else
${out.0.IDNumbergender} = “F”;
}
You can precede it by //#TL tag for faster recognizing TL Language