on 05-02-2008 12:35 PM
HI,
I have a dynamic table.I want to insert records of my own in specifil position(not at the END) say position -->11.How to insert in the table.
I tried with this code.My record is inserting perfectly.But its inserting the next record of the original table (12th position ) two times which should not happen.
Please see if I am wrong in this code:-
..................
IPrivateExportexView.IEt_Writeoff1Element bapi1stElement=null;
for(int p = 0;p < wdContext.nodeEt_Writeoff1().size(); p++){
if(p==11){ // I want to insert the record at position-->11
bapi1stElement = bapiNode.createEt_Writeoff1Element(new Zfrm_Writeoff_P());
bapi1stElement.setZzbusunit_D("##");// I m setting the value here
bapiNode.addElement(p,bapi1stElement);// I am inserting the record here
}
....................
Please suggest me.
Regards
-Sandip
hi,
To Insert the data in the particular row we should ensure that the the previous rows are filled.
For eg : if in a table we have only three rows , we want to insert the data in the 11th row then we have to fill the rows with empty values till 10th row and in the 11 th we can insert the data in the table .
Thanks and regards
Fistae
Edited by: Fistae on May 2, 2008 1:41 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
I have total 70 records in my table.
I want to inset at a perticular position in the table.
Can u please tell me how to insert without any error.
Is there any error in my insertion code above?
I am fetching the data for the table from Et_Writeoff1 node.
Please suggest with sample code.
Regards
-Sandip
Hi,
I am assuming no other code inside the for loop. if that is the case, you can directly insert the element at the specified position but make a check for the size. You dont
need any "for" loop in this case. I checked locally for this scenario, I am not getting any duplicates. If you have any other code in the for loop, may be that other code is effecting the 12th record. If you have that other code, show me that code. I will check that again.
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
In the Above code, u are executing the model for populating the table . but the datas are populated properly in the table and again when the if condition is true the data is fed again to the Table.
use this code:
IPrivateExportexView.IEt_Writeoff1Element bapi1stElement=null;
for(int p = 0;p < wdContext.nodeEt_Writeoff1().size(); p++){
if(p==11){ // I want to insert the record at position-->11
bapi1stElement = bapiNode.createEt_Writeoff1Element(new Zfrm_Writeoff_P());
bapi1stElement.setZzbusunit_D("##");// I m setting the value here
bapiNode.addElement(p,bapi1stElement);// I am inserting the record here
}
else{
set the values to empty or null
}
}
but i want to know whether u want to insert omly one table record or the whole data from the model to the table.
Thanks and regards
Fistae
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.