cancel
Showing results for 
Search instead for 
Did you mean: 

How to bindi a UI element to 2 model nodes different in the same view

Rodrigo-Giner
Active Contributor
0 Kudos

I want to know how I can bind a set of inputfields, in a form view, to 2 different model nodes ?

<u>example:</u>

Im working with 2 adaptional RFC, both working, in my Custom Context.

Ztest_Search

Ztest_Update

In my ResultView I have 2 Model nodes (one for each RFC) I show a set of inputfields in a form view, binded to the Ztest_Search_output of Ztest_Search. This works.

now I want to update the changes, but I can't find the ways of binding the same inputfields to my other Model node (Ztest_Update) in the context of ResultView.

Note: If I create a duplicate set of inputfields , one for Ztest_Search binded to the Ztest_Update_output and the other to the Ztest_Update_Input Works. But I wanna avoid this duplicated set of inputfields.

Thx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Rodrigo,

If I understood correctly, your problem is to get the data from the input fields which are bound to a

model node, Ztest_Search_output and set it to the model node of another RFC, Ztest_Update.

This can be done by getting the suitable values from the model attributes of Ztest_Search_output

and setting it to Ztest_Update.


<b>/**
 * valueOne, valueTwo are the name of the model    
 * attributes that are bound to the Input fields.
 */</b>
String firstValue = wdContext.currentZtest_Search_outputElement
     ().get<valueOne>;

String secondValue = wdContext.currentZtest_Search_outputElement
     ().get<valueTwo>;

Ztest_Update_Input update = new Ztest_Update_Input();
wdContext.nodeZtest_Update_Input().bind(update);

<b>/*
 *<b>Zstructure is the structure of the model node under 
 *Ztest_Update_Input to which the values have to be  
 *updated.</b>
 */</b>

ZStructure structure = new ZStruture();
structure.setValueOne(valueOne);
structure.setValueTwo(valueTwo);
update.addZStructure(structure);

try
{  	
   update.execute();	
}    
catch (Exception ex)
{    	
   wdComponentAPI.getMessageManager().reportException(ex.getMessage(), false);    		  	
}
   
wdContext.nodeZtest_Update_Output().invalidate();

Bala

Rodrigo-Giner
Active Contributor
0 Kudos

Thx Bala. That is exactly what I needed. Very Usefull your comments.

Resolved.

Answers (0)