Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
Can anyone say how to validate integer,float columns which have empty instead of the string "null"
I'm using below code but still, I'm getting an error like For input string: " "
I know in input one integer column is coming as empty.
Please help me to validate in the correct way.
in advanced properties for input component - check Trim All column
excluding rare cases when spaces is mandatory it help a lot in many cases
You can try
yourStringData.matches("[-+]?\\d*\\.?\\d+")
Hi,
I'm getting below error after trying possible ways.
Exception in component tMap_1 (Local_Booking)
java.lang.NumberFormatException
at java.math.BigDecimal.parseExp(BigDecimal.java:647)
at java.math.BigDecimal.<init>(BigDecimal.java:488)
at java.math.BigDecimal.<init>(BigDecimal.java:383)
at java.math.BigDecimal.<init>(BigDecimal.java:806)
at np_old.local_booking_0_1.Local_Booking.tFileInputExcel_1Process(Local_Booking.java:3492)
at np_old.local_booking_0_1.Local_Booking.runJobInTOS(Local_Booking.java:4571)
at np_old.local_booking_0_1.Local_Booking.main(Local_Booking.java:4420)
Hi,
Here is the code I'm using for string to Bigdecimal
row1.ORDER_DISCOUNT.equals("null")?null:new BigDecimal(row1.ORDER_DISCOUNT)
try this:
row1.ORDER_DISCOUNT==null||row1.ORDER_DISCOUNT.equals("")?null:new BigDecimal(row1.ORDER_DISCOUNT)
Here is a routine you can use......
public static boolean isNumeric(String data){
boolean returnVal = true;
try{
Integer.parseInt(data);
}catch(Exception ex){
returnVal = false;
}
return returnVal;
}
I use that to test if String values represent Integers. Just tweak the code to cater for Floats if you need to. It will return true or false based on what you supply the String parameter