on 09-16-2008 6:50 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
could you paste the error description here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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());
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.