How to know list key of document type in java service

Hello

I search in java API a function who return key list of a document type.
this function exist ?

How can i do that ?

Hi Clement,

can you provide an example of what you are trying, please?

Additionally provide your wM version, please.

Regards,
Holger

Hi,

We use 9.12.

I want know all élement in a doc type reference, and return a list of this element.

Example i pass in entry a String who represent mypackage.doc:mydoc

mydoc type is :
Doc

  • firstElement
  • firstNumber
  • otherElement

the list return :

  • firstElement
  • firstNumber
  • otherElement

Use the below code to get the NS and loop over “nodedata/rec_fields”, within the loop use “pub.list:appendToStringList” to populate the stringList which will return “field names”

 IDataCursor ic = pipeline.getCursor();
 String strName = IDataUtil.getString(ic, "nsName");
 if (strName == null) {
  throw new ServiceException("Missing required param 'nsName'");
 }
 NSName nsname = NSName.create(strName);
 IData data = NSNodeHelper.getNodeInfo(nsname);
 ic.insertAfter("nodedata", data);

Let me know if you are unable to follow instructions or not make it work.

Thx for your reply.

But i can t find class “NSNodeHelper”
I search for install package wmDoc. but in this package i have other java problem like WmDocBundle cannot be resolved to a type …

Can you help me to find this class and solved this problem ?

Use the attached package as-is

OR

Copy the java service (GetNodeData:getNodeData) to your package folder on designer and the folder “pub” which is present under “GetNodeData\code\classes” to your \code\classes, compile the java service and it should work.

Else, you need to create a jar from the NSNodeHelper.class (present in WmDoc) and copy the same under packages<yourpackagename>\code\jars

Let me know how it goes, feel free to contact me on my below email if you still have issues.
GetNodeData.zip (12.4 KB)