on 10-06-2008 6:05 AM
Hai
how to validate record by record in a Table webdynpro.
if record is not satisfied condition raise the exception.
before records, which are satisfied condition those are send to save and invalidate.
eg:- table contain 3 fields .
filed1, filed2 ,field3.
all 3 fields are mandatory.
Hi,
this code helps you,
IPrivate<name>View.I<name>TableNode i<name>TableNode = wdContext.node<name>Table();
IPrivate<name>View.I<name>TableElement i<name>TableElement;
for(int i=0;i<i<name>TableNode.size();i++){
i<name>TableElement = i<name>TableNode.get<name>TableElementAt(i);
if(i<name>TableElement.get<field1>()!=null&&i<name>TableElement.get<field1>()!=null&&i<name>TableElement.get<field1>()!=null){
// save records
....
}else{
wdComponentAPI.getMessageManager().reportException(i<name>TableElement.getSno()":""fields are mandatory",false);
}
}
}
Regards,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
observe the underline statement.
IPrivate<name>View.I<name>TableNode i<name>TableNode = wdContext.node<name>Table();
IPrivate<name>View.I<name>TableElement i<name>TableElement;
for(int i=0;i<i<name>TableNode.size();i++){
i<name>TableElement = i<name>TableNode.get<name>TableElementAt(i);
if(i<name>TableElement.get<field1>()!=null&&i<name>TableElement.get<field1>()!=null&&i<name>TableElement.get<field1>()!=null){
// save records
....
// remove this element from the node
i<name>TableNode.removeElement(i<name>TableElement );
}else{
wdComponentAPI.getMessageManager().reportException(i<name>TableElement.getSno()":""fields are mandatory",false);
}
}
}
Hi Ramesh this is my code
IPrivateAddClientView.ICreateClientNode createClientNode = wdContext.nodeCreateClient();
int nodeSize = createClientNode.size();
String clientName = null;
String region = null;
String vertical = null;
for(int i=0;i<nodeSize;i++)
{
IPrivateAddClientView.ICreateClientElement TableElement = createClientNode.getCreateClientElementAt(i);
if(TableElement.getClientName()!=null&&TableElement.getClientName()!="")
{
clientName = TableElement.getClientName();
region= TableElement.getRegion();
vertical= TableElement.getVerticals();
wdThis.wdGetTaskManagerCompController().insertClient(clientName,region,vertical);
wdContext.nodeCreateClient().removeElement(TableElement);
}
else{
wdComponentAPI.getMessageManager().reportException(TableElement.getClientName()+":"+"fields are mandatory",false);
break;
}
}
HI
There might be some problem in your code at
wdThis.wdGetTaskManagerCompController().insertClient(clientName,region,vertical);
I think in insertClient method you are trying to add elements to a particular node. Try to check the code or post ur code in insertClient method. If it is fine then check the node cardinality.
Regards
Raghu
Hai Ramesh , Raghu.
thanks for for giving replies to my issue.
here the thing is when iam using invalidate or remove method in
loop . i am getting Exception
java.lang.Indexoutof bound Exception
to eliminate record in frontend which record is inserted .
with out using the Remove() method , every thing is working fine.
but after save we need to invalidate.
Hi Eswar,
Every thing is fine, but still you are getting error....
For me also i faced with simillar Error when removing element in for loop, but when i tried removing element in for loop in reverse order it worked fine..So Just try by iterating the for loop in reverse order while removing the element.
for (int i = wdContext.createClientNode.size()- 1; i >= 0; --i)
Coorelate this type of iteration as per your requirement, probably it may solve your answer.
Regards
Raghu
Yes Raghu....
it is working...
its some what happy...
Its working in reverse Manner..down to top.
It is not possible in top to down....
And one thing the Error records that how many of records are error those many lines of messages it showing , how can avoid instead of these many lines , for all error records in one message line.
is there any other way tell me..
my issue can resolve...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eswar,
You mean you want to delete or remove the record(element) that satisfies your condition and try to remove the element from the node.
Try this code in your button action
for(int i=0;i<wdContext.node<<abc()>>.size();i++)
{
if<<your condition>>
{
wdContext.node<<abc()>>.removeElement(wdContext.nodeabc().getabcElementat(i));
}
}
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Ragu,
I tried u r code to eleminate record which is satisfied condition after method .
but result is if one record is entered in table.that everything is fine but in case many records entered in table.
In that case it raise the exception that is
Java.lang.Index out of Bound Exception
what is need to do ...
HI,
If I understand your question correctly, You want to display the records which satisfy come condition. If yes, follow this code
for(int i=0;i<wdContext.node<TableNode>().size();i++)
{
wdContext.node<TableNode>().setLeadSelection(i);
if( ! ( wdContext.current<TableNode>Element().get<Field1>() <Condition>
&&
wdContext.current<TableNode>Element().get<Field2>() <Condition>
&&
wdContext.current<TableNode>Element().get<Field3>() <Condition> ) )
wdContext.node<TableNode>().removeElement(wdContext.current<TableNode>Element());
}
Regards
LN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi lakshmi Narayana ,
thanks for ur reply,
Your assume is right that is table is input fileds of 3 like above.
each filed is mandatory, i have one Method that is insert method.
My cod s as below but iam getting error ...
Null pionter Exception, some time Java.lang.indexoutof boundException.
what is the reason , help me on this .
for(int index=0;index<nodeSize;index++)
{
if(wdContext.currentCreateClientElement().getClientName()!= null &&
wdContext.currentCreateClientElement().getClientName()!= "" )
{
IPrivateAddClientView.ICreateClientElement createClientElement = createClientNode.getCreateClientElementAt(index);
clientName = createClientElement.getClientName();
region = createClientElement.getRegion();
vertical = createClientElement.getVerticals();
wdThis.wdGetTaskManagerCompController().insertClient(clientName,region,vertical);
wdContext.nodeCreateClient().invalidate();
}
else
{
wdComponentAPI.getMessageManager().reportException("enterclientname",false);
}
}
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.