on 03-23-2009 8:07 AM
Dear Forum,
I am using a dropdownbyindex to populate values from R/3.
My requiremnt is initially the dropdown will show emply field. The user will select a value and submit. But if the user does not select and submits, the UI is throwing a Nullpointer exception.
I can avoid the null value in dropdown by setting the selection as 1...1 ; but this is not serving the purpose of blank value initially.
Please help me asap.
Thanks and regards,
Mickey.
Hi,
This is because you have binded the DDB Index to a context attribute and you are accessing it in your code.
So please use this statement in your code
if(wdContext.currentContextElemem.getAttr1()!=null){
// your code
}
else {
wdComponentAPI.getMessageManager().reportException("Plesae select a value in the drop down");
}
Hope this helps,
Jithin
Edited by: jithin james on Mar 23, 2009 9:17 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can add empty row in your r/3 table. it is possible i have done it previously. For R/3 nodes the cardinality is 0..n initially. You need to do instantisate the node in component controller. please change the model node cardinality by 0..n & instansitiate the node in your component controller. your problem will be solved.
Best Regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Everybody,
Thanks a lot for your suggestions. I solved the issue.
I made the UI property "setInitialized" to true which allowed the blank entry (provided by framework) to get displayed. Then I kept a check on null pointer exception where in it is mandatory for the user to enter a value to dropdown before submitting the form.
Thanks again,
Best regards,
Mickey.
Hi Mickey,
You can achive it by setting the selection as 1...1 and then before taking the data from R3 and adding it to dropdown what you can do is.
Create a String string blank ="";
and now assign this value to the node element. and now assign the vlaue from R3 to this node.
This will solve your problem.
Hope this will help
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ..
you have to create VALUE NODE in component Context...and mapping Into VIEW context through open navigator model..
inputdrop----is the attribute name
SearchCriteria--Value node
In component implemation you have to put some code..in appropriaate method...
IWDAttributeInfo attrinfo=wdContext.nodeSearchCriteria().getNodeInfo().getAttribute("inputdrop");
ISimpleTypeModifiable msType=attrinfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet3=msType.getSVServices().getModifiableSimpleValueSet();
valueSet3.put("Plese choose");
for(int i=0;i< model node size;i++)
{
valueSet3.put(wdContext.node<model>().get<model>ElementAt(i).getAttributeAsText("your value in model as key",wdContext.node<model>().get<model>ElementAt(i).getAttributeAsText("your value in model as description")
}
wdContext.currentSearchCriteriaElement().setInputdrop("Please choose");
thanks..
sudhira
Edited by: sudhir kumar on Mar 23, 2009 10:44 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please post the trace of the error
Check in your code for a call to the metthod "currentContextElement" of the respective node and make sure that you check for the null before calling this method.
Ex:
if(!wdContext.nodeEmployees().isEmpty()) // Employee is the node Name
id = wdContext.currentEmployeesElement().getEmpID()
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mickey,
Please check the value of the dropdown field & if it is not null then call the code in onAction method of Submit button.
Kind Regards,
Nitin
PS: I feel your application logic should handle it in a more efficient manner than to check for null values.
You may enable the submit button only if the dropdown is filled (associate a label & mark it as mandatory), and in onSelect method of dropdown, make the submit button enabled.
Edited by: Nitin Jain on Mar 23, 2009 9:19 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Just it require a null check then only retrieve the value from dropdown
if(Wdcontext.currentContextElemem.getValue !=null)
{
//code
}
Other solution is populate the value form R/3 in Dropdown (only if it is less than 50), else use EVS for better functionality(Default filter is there for large body data say 100-150),
Best Regards
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.