cancel
Showing results for 
Search instead for 
Did you mean: 

getting error for input string 0000 #

Former Member
0 Kudos

Hi ,

I am getting error on the portal that has an exception as error occured for For input string: "0000 #" .I think its because of some problem with the RFC that m getting this error but please suggest.The code done with dynamic coding is given below:

for(int j=0; j<intList; j++)

{

IDynamicNodeElement dynObj = wdContext.createDynamicNodeElement();

strLine = wdContext.nodeWeb_Table_Disp1_Out().getWeb_Table_Disp1_OutElementAt(j).getTline();

intLine = strLine.length();

strLine = strLine.substring(1,intLine-1);

String[] strArr = strLine.split("#");

for(int k=0;k<intCat;k++)

{

String strVal = strArr[k];

if(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getDatatype().equalsIgnoreCase("DATE"))

{

try

{

String strdate ="";

SimpleDateFormat ch1 = new SimpleDateFormat("yyyyMMdd");

//wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(wdContext.currentUser_ProfileElement().getDatefmt()+strVal);

String strFmt = "";

if("YYYY/MM/DD".equalsIgnoreCase(wdContext.currentUser_ProfileElement().getDatefmt()))

{

strFmt = "yyyy/MM/dd";

}

else

{

strFmt = "MM/dd/yyyy";

}

SimpleDateFormat ch2 = new SimpleDateFormat(strFmt);

strVal = strVal.trim();

if(!"".equals(strVal))

{

strdate = ch2.format(ch1.parse(strVal));

} dynObj.setAttributeValue(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getFieldname(),strdate);

}

catch(Exception e)

{

}

}

else if(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getDatatype().equalsIgnoreCase("QUAN"))

{

Double dblVal = null;

DecimalFormat sdf = new DecimalFormat("#,###.####");

dblVal = new Double(strVal);

if(!strVal.matches("(?i).-."))

{

dblVal = new Double(strVal);

dynObj.setAttributeValue(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getFieldname(),new BigDecimal(strVal.trim()));

}

else

{

dynObj.setAttributeValue(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getFieldname(),null);

}

}

else

{

dynObj.setAttributeValue(wdContext.nodeField_Catalog_Disp1_Out().getField_Catalog_Disp1_OutElementAt(k).getFieldname(),strVal);

}

col.add(dynObj);

}

}

}

wdContext.nodeDynamicNode().bind(col);

Please help.

Thanks & Regards,

Reinuka.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Did you check what is the Input string being split? Also check what is the date and date format.This is the debugging you need to do now i believe.

Thanks,

Np

Former Member
0 Kudos

Thank you all.

I have got the solution of this problem.The cause was it wasnt going into the loop for chinese language.So, i get the languagecode from locale.getlanguage() and accorrdingly the code is picking the language and displaying correct data.There was nothing wrong with the date format.

former_member187439
Active Participant
0 Kudos

could you paste the error description here?

Former Member
0 Kudos

Error Occurred in WdDoModifyView Method of DisplayList View. Please contact System Administrator java.lang.NumberFormatException: For input string: "0000 #"

former_member187439
Active Participant
0 Kudos

I guess the reason for the exception is the "date format" and conversions. Try something like this.

SimpleDateFormat sdf = new SimpleDateFormat("date format you want");

java.util.Date asDate = sdf .parse(codes.getString("your date value").trim());

node element to which you want to set the date value.setfieldname(asDate.getTime());

Example:

 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date asDate = sdf .parse(codes.getString("DELIV_DATE").trim());
outboundpr.setDel_date(asDate.getTime());