cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot select the elements of second level node

Former Member
0 Kudos

Hello,

I have a context like:

Document (cardinality 1-1)

files (cardinality (0-n)

fileKeyWord (cardinality (0-n)

searchText (element)

I cannot get all searchText elements from the selected files element. If I get the currentFilesElement, I can have all atributes corresponding to the selected files node. But If I try to have the corresponding searchtext of the files element by calling in a for loop

wdContext.nodeFileKeyWord().getFileKeyWordElementAt(i).getSearchText(),

-> I have either all the searchtext elements from all files elements or nothing !!

Is there is a bug or I don't call the right function

Thanks

Quentin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Assuming your context structure is


Document (cardinality 1-1)
  Files (cardinality 0-n)
    FileKeyWord (cardinality 0-n, singleton=false)
      searchText (attribute, string)

This should give you what you need:


IFilesElement file = wdContext.currentFilesElement();
for (int i = 0, n = file.nodeFileKeyWord().size(); i < n; ++i)
{
  IFileKeyWordElement e = file.nodeFileKeyWord().getFileKeyWordElementAt(i);
  String searchText = e.getSearchText();
}

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Armin, it is working now. I tried all the possibilities but this one is working.

By accessing the node from the corresponding element, I succeed to have my keywords

Quentin

Former Member
0 Kudos

That's the semantics of the "singleton" property of a child node:

singleton=false: every parent element has its own instance of the child node

singleton=true: child node exists only for lead-selected parent element

Armin

Former Member
0 Kudos

Hi,

Check the singleton property of the node.

Regards

Ayyapparaj

Former Member
0 Kudos

There are set to true.

I need only all searchtext elements from the FileKeyWord node corresponding to the current file only. So in other words, i need all keywords of the corresponding selected/current file.