Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
I have an input file delimited and i need to divide the number of records (tFileRowCount_2_COUNT) by 4 in a tjava component.
I need the below expected result. Can someone help on this please?
Note: my context variable (context.nombre_ligne) is of type integer.
Best regards,
RA
Hi @Rohit Aftab , if you want to round up, try the method Math.ceil() instead of Math.round().
Send me love and kudos
it is not working :
context.nombre_ligne = (int)java.lang.Math.ceil(((Integer)globalMap.get("tFileRowCount_2_COUNT")/4));
System.out.println(context.nombre_ligne);
10records / 4 => i have result => 2
it should have been 3.
Best regards,
RA
cast your integer as a double and it will work
Hi @Rohit Aftab,
(int) Math.ceil(row7.records/4.0)
context.nombre_ligne = (int) Math.ceil(((Integer)globalMap.get("tFileRowCount_2_COUNT")/4.0));
System.out.println(context.nombre_ligne);
Kind regards,
😷