on 05-13-2009 1:02 PM
Hi,
i have to add new values through UI i.e giving input through views.
I have a context node CAR having sub node engine and owner.
Engine node consist of Rpm,Bhp as value attribute
Owner node consist of name,phnno as value attribute
Now i have to take input from some view and store that values in the node and sub node.
pls guide
Thanks & Regards
Pravin Jha
HI
make the cardinality of the nodes to 1..n
and write this piece of code
String carName=wdContext.nodeCar().currentCarElement().getCarname();
String carNumber=wdContext.nodeCar().currentCarElement().getCarnum();
String Rpm=wdContext.nodeEngine().currentEngineElement().getRpm();
String Bpm=wdContext.nodeEngine().currentEngineElement().getBpm();
String name=wdContext.nodeOwner().currentOwnerElement().getName();
String phoneNumber=wdContext.nodeOwner().currentOwnerElement().getPhoneno();
IPrivateDemoGraphCompView.ICarElement carElement=wdContext.nodeCar().createCarElement();
carElement.setCarname(carName);
carElement.setCarnum(carNumber);
wdContext.nodeCar().addElement(carElement);
IPrivateDemoGraphCompView.IEngineElement engine =wdContext.nodeEngine().createEngineElement();
engine.setBpm(Rpm);
engine.setRpm(Bpm);
wdContext.nodeEngine().addElement(engine);
IPrivateDemoGraphCompView.IOwnerElement owner =wdContext.nodeOwner().createOwnerElement();
owner.setName(name);
owner.setPhoneno(phoneNumber);
wdContext.nodeOwner().addElement(owner);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Parveen,
To add new elements from the input fields to the attributes of the desired nodes, use the following code.
this code is written in the eventhandler of a click event of the button.
public void onActionSubmitDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSubmitDetails(ServerEvent)
String Name = wdContext.currentContextElement().getNameInput(); // bind these attributes to the input fields
String PhoneNo = wdContext.currentContextElement().getPhoneNoInput();// bind these attributes to the input fields
String Bhp = wdContext.currentContextElement().getBhpInput();// bind these attributes to the input fields
String Rpm = wdContext.currentContextElement().getRpmInput();// bind these attributes to the input fields
IPrivateTableTestView.ICARElement Car_el = wdContext.createCARElement();
wdContext.nodeCAR().addElement(Car_el);
IPrivateTableTestView.IOwnerElement ownerElement = wdContext.createOwnerElement();
ownerElement.setName(Name);
ownerElement.setPhoneNo(PhoneNo);
wdContext.nodeOwner().addElement(ownerElement);
IPrivateTableTestView.IEngineElement engineElement = wdContext.createEngineElement();
engineElement.setBhp(Bhp);
engineElement.setRpm(Rpm);
wdContext.nodeEngine().addElement(engineElement);
//@@end
}
let me know if you still have any issue.
Sarbjeet Singh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please post the exact context structure, including cardinalities and singleton-properties.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pravin Jha,
Try this code.
IPrivate<View name>.IN_LabelElement ele = wdContext.createN_LabelElement();
ele.setA_label("Label Name");
wdContext.nodeN_Label().addElement(ele);
IPrivate<View name>.IEngineElement engineEle = wdContext.createEngineElement();
engineEle.setBhp("BHP value");
engineEle.setRpm("RPM value");
IPrivate<View name>.IOwnerElement ownerEle = wdContext.createOwnerElement();
ownerEle.setName("Owner name");
ownerEle.setPhnno("Owner Phone no");
wdContext.nodeEngine().addElement(engineEle);
wdContext.nodeOwner().addElement(ownerEle);
Let me know if you need any clarification
Regards,
Jaya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.