about add Rule of Relationship automatically

Hi, everyboy

 Can I add Rule of Relationship automatically (by PLM SDK API)?
I try to do following, but I got the error code.

Error code : 60072
Error message : Unsupported operand datatype

My PLM version: 9.3.2

 

ITable relationship_Table = change.getTable(ChangeConstants.TABLE_RELATIONSHIPS);
Iterator ite = relationship_Table.iterator();
    while (ite.hasNext()) {
        IRow row_relation = (IRow) ite.next();
        row_relation.setValue(new Integer(2000007765), “When PCR-00000105 is \”ABC\”, set BRP-00001080 to \”RDC\””);
    }

No Files Were Attached
chlin2828 Agile User Asked on March 12, 2018 in Other APIs.
Add Comment
2 Answer(s)
Best answer

Hi,

Actually you need to think through your solution here. So ABC or RDC here does it denotes workflow status? .

Below is the code i have tested to check when my Base Change moves to released my impacted change should also move to release.

            IChange base_change = loadChangeObj(“ECO-000001”);                //Loading the base change
                IChange dependent_change = loadChangeObj(“ECO-000002”); // Loading the dependent change
                if (base_change != null) {
                    ITable my_rel_table = base_change.getTable(ChangeConstants.TABLE_RELATIONSHIPS); //Loading the relationship table
                     Iterator<?> my_iter = my_rel_table.iterator();
                    HashMap rulemap = new HashMap();

                    IStateful state = (IStateful) base_change;
                     IStatus[] statuses = state.getStates();
                     IStatus basechange_status = null;

                    for (int i = 0; i < statuses.length; i++) {
                         if (statuses[i].getName().equals(“Released”)) {
                             basechange_status = statuses[i];   //Getting the desired workflow status of base change
                             break;
                         }
                     }

                     state = (IStateful) dependent_change;
                     statuses = state.getStates();
                     IStatus dependent_change_status = null;
                     for (int i = 0; i < statuses.length; i++) {
                         if (statuses[i].getName().equals(“Released”)) {
                             dependent_change_status = statuses[i];  //Getting the desired workflow status of dependent change
                             break;
                         }
                     }

                    while (my_iter.hasNext()) {
                       //As rules are set at the row level. So a row must be present in the relationship tab.

                        IRow m_row = (IRow) my_iter.next();
                        rulemap.put(CommonConstants.ATT_RELATIONSHIPS_RULE_CONTROLOBJECT, base_change);   
                         rulemap.put(CommonConstants.ATT_RELATIONSHIPS_RULE_AFFECTEDOBJECT, dependent_change);
                         rulemap.put(CommonConstants.ATT_RELATIONSHIPS_RULE_CONTROLOBJECTSTATUS, basechange_status);
                         rulemap.put(CommonConstants.ATT_RELATIONSHIPS_RULE_AFFECTEDOBJECTSTATUS, dependent_change_status);
                         m_row.setValue(CommonConstants.ATT_RELATIONSHIPS_RULE, rulemap);
                         
                         System.out.println(m_row.getCell(CommonConstants.ATT_RELATIONSHIPS_RULE));
                      }

                }

Please let me know if it helps.

Regards,
Arif

Arif Agile Angel Answered on March 12, 2018.
Add Comment

It’s work. Thank you!

chlin2828 Agile User Answered on March 23, 2018.

Glad it helped.

Regards,
Arif

on March 23, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.