cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically retrieve a tables bound context node

michael_voss2
Participant
0 Kudos

Hello everybody!

We're currently trying to implement a generic export from WebDynpro tables to Excel files using a faceless WebDynpro DC as described here. The main functionality works fine, but I have to explicitly define the context node (IWDNode instance) I want to export data from. To make the functionality more convenient, I'm trying to get the context node directly from the table's dataSource mapping. I can get the path to the node using

IWDTable table = (IWDTable)view.getElement(tableName);

String dataSourceNodeName = table.bindingOfDataSource();

but I cannot see a way to get the actual node (IWDNode instance) that I'll have to pass to the exporter, regardless of elements being present or not inside that node.

wdContext.currentContextElement().node(dataSourceNodeName);

does not work as expected (it returns null), and

wdContext.getChildNode(dataSourceNodeName, IWDNode.LEAD_SELECTION);

returns null, too. Do you know of any working way to retrieve the actual node from it's path or name or, even better, from the IWDTable element itself?

Thanks

Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

once you get the node, can't u use the generic api to get all the attributes?

michael_voss2
Participant
0 Kudos

Yes, that would be fairly easy. The problem ist how to get hold of the node itself! I seem to be able to get the name of the node, but not the node itself.

junwu
Active Contributor
0 Kudos

are u sure? what code you are using?

michael_voss2
Participant
0 Kudos

My table view element's dataSource is bound to a data node "MySuperNode.TableDataSourceNode" with Collection Cardinality 0..n like this:


Inside wdDoModifyView, I'm retrieving the relevant table element using

String myTableName = "someViewElementName";

IWDTable table = (IWDTable)view.getElement(myTableName);

Then I get the table's dataSource using

String dataSourcePath = table.bindingOfDataSource();

This returns the path to the context node bound as dataSource below the main context node, in the above case it's "MySuperNode.TableDataSourceNode". It would be great to be able to retrieve the actual node instead of it's path, but I do not find any method that might be appropriate for this. So I try to get the actual node from this path:

IWDNode dataNode = wdContext.currentContextElement().node(dataSourcePath);

This returns null. Another approach was

     IWDNode dataNode = wdContext.getChildNode(dataSourcePath, IWDNode.LEAD_SELECTION);

or

     IWDNode dataNode = wdThis.wdGetMyViewController().wdGetAPI().getContext().getRootNode().getChildNode(dataSourcePath, IWDNode.LEAD_SELECTION);

but I do not get anything but null. Maybe I'll have to add something to or remove something from the path ?

junwu
Active Contributor
0 Kudos

what's value of singleton attribute for the node "MySuperNode"?

michael_voss2
Participant
0 Kudos

Both nodes are Singletons, i. e. the property value of "Singleton" is "true". Since "MySuperNode" is an independent node, this cannot be changed. Btw., in the real world applications, more subnodes are possible below "MySuperNode", of course...