cancel
Showing results for 
Search instead for 
Did you mean: 

The new java api , taxonomy hierarchy , how to tell the difference between

Former Member
0 Kudos

I have the following code :


		   
	//mainTable ID	    
	TableId mainTableId = new TableId("T30");
	
FieldId[] fields = new FieldId[2];
		//PDM Table
		FieldId cat_Code = new FieldId("F49_71148");
		FieldId cat_Name = new FieldId("F46_71147");

		fields[0] =  cat_Code;
		fields[1] =  cat_Name;

ResultDefinition rd = new ResultDefinition(mainTableId);
 rd.setSelectFields(fields);

 //Create constraint and dimension for key word search
KeywordSearchDimension keySearchDimension = new KeywordSearchDimension();

 KeywordSearchConstraint keySearchConstraint = new KeywordSearchConstraint("rolamento", KeywordSearchConstraint.CONTAINS);

 //Create the Search and add the key word constraint
Search search = new  Search(mainTableId);
 search.addSearchItem(keySearchDimension,keySearchConstraint);


RetrieveLimitedRecordsCommand retLim = new RetrieveLimitedRecordsCommand(conn);
retLim.setResultDefinition(rd);
retLim.setSearch(search);
retLim.setSession(session);

try {
	retLim.execute();
	RecordResultSet rs = retLim.getRecords();
	for (int i = 0; i < rs.getCount(); i++) {
		TableSchema tschema = rs.getRecord(i).getMetadata();
		System.out.print(rs.getRecord(i).getDisplayValue());
	}
} catch (CommandException e5) {
	// TODO Auto-generated catch block
	e5.printStackTrace();
}catch (NullPointerException e) {
	e.printStackTrace();
} 		
 	}

This brings me back all of the records from the table “PDM” that matches the search query (in this case “rolamento” ) .

From the results what is the best way to get the hierarchy of the records (who is a parent and who is a child , or who has a child )

Or , is there a better way to get the hierarchy of the taxonomy table ?

I searched sdn css and the javadocs but I haven’t found a solution

Any help is great help.

Thanks in advance.

Guy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

found it on my own . the best way to do this is use the RetriveLimitedHierTreeCommand with a search on the taxonomy table.