cancel
Showing results for 
Search instead for 
Did you mean: 

Data overwriting n not getting displayed in seperate ro

former_member211107
Participant
0 Kudos

Hi Experts,

I have a very simple doubt here.

I have two popups with me. Say popup1 and popup2. Both are tables.

popup2 opens through popup1. I have some data in popup2 which i have to pass to popup1. I select one row in popup2 and pass the same to popup1 on the click of button "ok". Now if I again select another row from popup2 and press the button "ok". the new value overwrites the old value in pupup1.

I need the new value from popup2 to be displayed in a new row in popup1 n no overwriting should happen.

In short, the data in popup1 coming from popup2 is not getting poplutaed in seperate rows, instead it is overwriting the previous entry.

Please suggest me complete code to iterate the data in different rows or else letme know if i have to make changes in some property of my tables in popup.

Best Regards,

Kaustubh

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Kaustubh,

Say the two table nodes are table1, table2

I assume you have done the context mapping from popup1 to popup2 (table1 node). In "ok" event handler write this code and try

IPrivate<viewname>.ITable1Element ele = wdContext.createTable1Element();
ele.setAttrib1(wdContext.currentTable2Element().getAttrib1());
ele.setAttrib2(wdContext.currentTable2Element().getAttrib2());   
wdContext.nodeTable1().addElement(ele);

Regards,

Siva

former_member211107
Participant
0 Kudos

Hi Siva,

Thanks for the quick reply.

Well what I could understand from the piece of code is that it is limited to two entries only. But in my case from the popup2 i can search for as many employees as i want and populate them in popup1 table. So can i have something which can be used to add a minimum of ten entries in my popup1 table?

Best regards,

Kaustubh

former_member197348
Active Contributor
0 Kudos

Hi Kaustubh,

I just gave sample code. You can set the as many number of attributes (fields in the table) as you required. The code adds every time one row to popup1 table.

IPrivate<viewname>.ITable1Element ele = wdContext.createTable1Element();

// add as many attributes as you want

ele.setAttrib1(wdContext.currentTable2Element().getAttrib1());

ele.setAttrib2(wdContext.currentTable2Element().getAttrib2());

// finally add the new record to the Table1

wdContext.nodeTable1().addElement(ele);

Regards,

Siva

Answers (2)

Answers (2)

former_member185879
Active Contributor
0 Kudos

Hi Kausthab,

you want to get the details or rows selected in the popup2 to popup1 right?

Get the current row from the popup2 and store it in another(say Node1) node while clicking ok.

write another piece of code to get the size of the Node1. Once you got the size then loop that and create element for the popup1 table node.

Simple.

I think this is your problem

Regards

SM Nizamudeen

Former Member
0 Kudos

You will have to write some if loops to check if data is already present in the node which you are populating when passing data from popup2 to popup1. If the size of the node is greater than 0 you can then create a new element and add it to the node on click of the button in popup2.

Thanks,

GLM