Skip to main content
7-Bedrock
June 23, 2026
Solved

Api to get NonConformance Review

  • June 23, 2026
  • 2 replies
  • 58 views

how to get the NonConformance Review through the NonConformance object.

Best answer by Fadel

try below : 

package ext;

import com.ptc.qualitymanagement.nc.Nonconformance;
import com.ptc.qualitymanagement.nc.review.NCReview;
import wt.query.OrderBy;
import wt.query.QueryException;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.fc.QueryResult;    
import wt.util.WTException;
import wt.pds.StatementSpec;
import wt.fc.PersistenceHelper;

public class NCService{

public static NCReview getNCReview(Nonconformance NC) throws WTException {

         
        NCReview review = null;
 try {
        QuerySpec qs = new QuerySpec(NCReview.class);
        qs.appendWhere(new SearchCondition(NCReview.class,
                NCReview.NONCONFORMANCE_REFERENCE + ".key.id",
                SearchCondition.EQUAL,
                NC.getPersistInfo().getObjectIdentifier().getId()),
                new int[]{0});
        QueryResult results = PersistenceHelper.manager.find((StatementSpec)qs);
        if(results.hasMoreElements())    {
            Object obj = results.nextElement();
            if(obj instanceof NCReview) {
                review = (NCReview) obj;
            }
        } 
        return review;
    }catch(WTException e){
        System.err.println("Exception" +e);
    }
return review;
}


}

2 replies

Catalina
Community Moderator
June 23, 2026

Hi ​@SB_19451911 

 

Thank you for your post! 

 

I’d like to recommend to bring more details and context to your initial inquiry. 

Please add screenshot(s) to better understand what you are trying to do in your process. 

 

Please refer to this guideline to make your questions more likely to receive a quick and useful answer. 

This will increase your chances to receive meaningful help from other Community members. 

 

Here's what a good question for Windchill looks like.

 

Thank you for your participation and please let me know if you need further assistance! 

 

Best regards,

Catalina

PTC Community Moderator

Catalina | PTC Community Moderator
Fadel
23-Emerald II
June 24, 2026

what windchill version ? java or RSET API

Buiꓘa
7-Bedrock
June 25, 2026

windchill 12.0.2.0 java api i need.

Fadel
Fadel23-Emerald IIAnswer
23-Emerald II
June 25, 2026

try below : 

package ext;

import com.ptc.qualitymanagement.nc.Nonconformance;
import com.ptc.qualitymanagement.nc.review.NCReview;
import wt.query.OrderBy;
import wt.query.QueryException;
import wt.query.QuerySpec;
import wt.query.SearchCondition;
import wt.fc.QueryResult;    
import wt.util.WTException;
import wt.pds.StatementSpec;
import wt.fc.PersistenceHelper;

public class NCService{

public static NCReview getNCReview(Nonconformance NC) throws WTException {

         
        NCReview review = null;
 try {
        QuerySpec qs = new QuerySpec(NCReview.class);
        qs.appendWhere(new SearchCondition(NCReview.class,
                NCReview.NONCONFORMANCE_REFERENCE + ".key.id",
                SearchCondition.EQUAL,
                NC.getPersistInfo().getObjectIdentifier().getId()),
                new int[]{0});
        QueryResult results = PersistenceHelper.manager.find((StatementSpec)qs);
        if(results.hasMoreElements())    {
            Object obj = results.nextElement();
            if(obj instanceof NCReview) {
                review = (NCReview) obj;
            }
        } 
        return review;
    }catch(WTException e){
        System.err.println("Exception" +e);
    }
return review;
}


}

Buiꓘa