on 12-02-2008 3:51 AM
hi all,
can any one suggest me a better method for copying a node element to a new node.I am using the following code.. is there any alternative..?
String string = wdContext.nodeFlight_List().getFlight_ListElementAt(lead).getAirline();
String string1 = wdContext.nodeFlight_List().getFlight_ListElementAt(lead).getAirportfr();
String string2 = wdContext.nodeFlight_List().getFlight_ListElementAt(lead).getAirportto();
String string3 = wdContext.nodeFlight_List().getFlight_ListElementAt(lead).getCityfrom();
String string4 = wdContext.nodeFlight_List().getFlight_ListElementAt(lead).getCityto();
IPrivateResult_view.IDummyElement ele = wdContext.nodeDummy().createDummyElement();
ele.setAirline(string);
ele.setAirportfr(string1);
ele.setAirportto(string2);
ele.setCityfrom(string3);
ele.setCityto(string4);
wdContext.nodeDummy().addElement(ele);
*********************************************************************************************in next view***
IPrivateTable_view.IDummyElement ele = wdContext.createDummyElement();
ele.setAirline(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getAirline());
ele.setAirportfr(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getAirportfr());
ele.setAirportto(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getAirportto());
ele.setArrdate(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getArrdate());
ele.setArrtime(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getArrtime());
ele.setCityfrom(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getCityfrom());
ele.setCityto(wdThis.wdGetWd_dc_custom_componentController().wdGetContext().currentDummyElement().getCityto());
wdContext.nodeDummy().addElement(ele);
Jithin,
check these threads
https://forums.sdn.sap.com/click.jspa?searchID=19377597&messageID=6519652
https://forums.sdn.sap.com/click.jspa?searchID=19377703&messageID=6519652
Thanks
Bala Duvvuri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jithin,
You can use wdCopyService methods like this. But this copies entire source node (all the node elements) to target node.
If it suits your requirement, you can copy like this:
wdCopyService.copyElements(wdContext.nodeFlight_List(),wdContext.nodeDummy() );
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use this code
int listSize = wdContext.node<Node name>().size();
for(int i=0; i< listSize; i++)
{
if(wdContext.node<Node name>().isSelected(i))
{
String strName = wdContext.node<Node name>().get<Node Name>ElementAt(i).get<Attribute name>();
IPrivate<View Name>.I<Node Name>Element element = wdContext.node<Node Name>().create<Node Name>Element();
element.<Attribute name>(strName );
wdContext.node<Node Name>().addElement(element);
}
}
with this code you can achive multiple selection functionality.
for single selection:
String strName = wdContext.node<Node name>().get<Node Name>ElementAt(leadSelect).get<Attribute name>();
IPrivate<View Name>.I<Node Name>Element element = wdContext.node<Node Name>().create<Node Name>Element();
element.<Attribute name>(strName );
wdContext.node<Node Name>().addElement(element);
Thanks
Hi,
Yes, you should use copyCorresponding method. So in your case (looking at your first post) the code will look like:
IPrivateTable_view.IDummyElement ele = wdContext.createDummyElement();
WDCopyService.copyCorresponding(
wdThis
.wdGetWd_dc_custom_componentController()
.wdGetContext()
.currentDummyElement(),
ele);
wdContext.nodeDummy().addElement(ele);
Note that copyCorresponding works only if the source & target nodes both have exactly similarly named attributes.
Regards,
Satyajit.
Hi
WdCopyService(Object source, Object target)
PS: both node attributes value should be same and data type as well.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
refer the below threads,
refer this API also,
https://help.sap.com/javadocs/NW04S/current/wd/index.html
Regards,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.