Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

How to retrieve Change Activity Sequence without SQL (Windchill Change Planning)?

SP_12330653
4-Participant

How to retrieve Change Activity Sequence without SQL (Windchill Change Planning)?

Hello Team,

I need to programmatically retrieve the Sequence value of a Change Activity (WTChangeActivity2) as it appears in the Change Planning / Execution Plan. Currently, the only method that works is executing a direct SQL query on the CHANGEPLANACTIVITY table.

Example SQL (working):

SELECT parent.SEQUENCE
FROM WTCHANGEACTIVITY2MASTER cam
JOIN WTCHANGEACTIVITY2 ca
    ON ca.IDA3MASTERREFERENCE = cam.IDA2A2
JOIN CHANGEPLANNINGLINK cpl
    ON cpl.BRANCHIDA3B5 = ca.BRANCHIDITERATIONINFO
JOIN CHANGEPLANACTIVITY cpa
    ON cpa.IDA2A2 = cpl.IDA3A5
LEFT JOIN CHANGEPLANACTIVITY parent
    ON parent.IDA2A2 = cpa.IDA3PARENTREFERENCE
WHERE cam.WTCHGACTIVITYNUMBER = ?
 

However, this is not a supported API approach, and I want to avoid SQL.

I also tried using:

ChangePlanningHelper.modifyPlan(...)
Map<VersionableChangeItem, String> changeSeqMap
But this map only accepts sequence values for updates — it does not expose or return the current sequence.
changeSeqMap.get(ca) always returns null.
SP_12330653_0-1770717431137.png

 

Question:

Is there any supported Windchill Java API (ChangePlanningHelper, ChangeHelper2, WTChangeActivity2, Info*Engine, etc.) that allows retrieving a Change Activity’s sequence number without using SQL?

If yes, please provide an example.
If not, can PTC confirm that SQL is the only available method?

 

Thanks in advance.

ACCEPTED SOLUTION

Accepted Solutions
Imad_A
13-Aquamarine
(To:SP_12330653)

Hello @SP_12330653 

 

you can use this :

String sequenceNumber = (String) ChangePlanningHelper.getService().getExecutionValues(changeNotice).get(task);



Imad_A_0-1770729974700.png

 

        String CNNumber = "CHN00000001";
        String taskNumber = "00001";

        
        WTChangeActivity2 task =null;
        WTChangeOrder2 changeNotice = null;

        QuerySpec qs = new QuerySpec(WTChangeOrder2.class);
        qs.appendWhere(new SearchCondition(WTChangeOrder2.class, WTChangeOrder2.NUMBER, 
        		SearchCondition.EQUAL,CNNumber , false),new int[] { 0 });
        QueryResult results = PersistenceHelper.manager.find(qs);
        if (results.hasMoreElements()) {
        	changeNotice = (WTChangeOrder2) results.nextElement();
        }
        
        
        
     	QuerySpec qstask = new QuerySpec(WTChangeActivity2.class);
     	qstask.appendWhere(new SearchCondition(WTChangeActivity2.class,WTChangeActivity2.NUMBER, 
				SearchCondition.EQUAL, taskNumber),new int[] { 0 });
		
        QueryResult resultsTasks = PersistenceHelper.manager.find(qstask);
        if (resultsTasks.hasMoreElements()) {
        	task = (WTChangeActivity2) resultsTasks.nextElement();
        }
        
    
      String sequenceNumber = (String) ChangePlanningHelper.getService().getExecutionValues(changeNotice).get(task);
    


 

View solution in original post

7 REPLIES 7
Fadel
23-Emerald I
(To:SP_12330653)

Hi @SP_12330653,

There is a API getSequence() in ChangePlanActivity.

Could you check?

changePlanActivity.getSequence();
SP_12330653
4-Participant
(To:TDT)

There is no changePlanActivity.class in Windchill.

Which version are you using?

The Class is available in version 13.0

TDT_0-1770732081944.png

 

HelesicPetr
22-Sapphire II
(To:SP_12330653)

Hi @SP_12330653 

Yes there is .

HelesicPetr_1-1770733207960.png

HelesicPetr_0-1770733183794.png

You just need to install a Project Link. 

 

the class is definitely available in Windchill 11.+ I do not have earlier versions now 😄 

 

PetrH

Imad_A
13-Aquamarine
(To:SP_12330653)

Hello @SP_12330653 

 

you can use this :

String sequenceNumber = (String) ChangePlanningHelper.getService().getExecutionValues(changeNotice).get(task);



Imad_A_0-1770729974700.png

 

        String CNNumber = "CHN00000001";
        String taskNumber = "00001";

        
        WTChangeActivity2 task =null;
        WTChangeOrder2 changeNotice = null;

        QuerySpec qs = new QuerySpec(WTChangeOrder2.class);
        qs.appendWhere(new SearchCondition(WTChangeOrder2.class, WTChangeOrder2.NUMBER, 
        		SearchCondition.EQUAL,CNNumber , false),new int[] { 0 });
        QueryResult results = PersistenceHelper.manager.find(qs);
        if (results.hasMoreElements()) {
        	changeNotice = (WTChangeOrder2) results.nextElement();
        }
        
        
        
     	QuerySpec qstask = new QuerySpec(WTChangeActivity2.class);
     	qstask.appendWhere(new SearchCondition(WTChangeActivity2.class,WTChangeActivity2.NUMBER, 
				SearchCondition.EQUAL, taskNumber),new int[] { 0 });
		
        QueryResult resultsTasks = PersistenceHelper.manager.find(qstask);
        if (resultsTasks.hasMoreElements()) {
        	task = (WTChangeActivity2) resultsTasks.nextElement();
        }
        
    
      String sequenceNumber = (String) ChangePlanningHelper.getService().getExecutionValues(changeNotice).get(task);
    


 

SP_12330653
4-Participant
(To:Imad_A)

Thanks, it Worked.

Announcements


Top Tags