Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am looking for a way to query a particular attributes value of an object attached to a promotion request. We are using Windchill 10.0 M040 and will be updating to 10.1 M030 this weekend.
For example, we have a custom boolean attribute (CertificationControlled)attached to the DefaultEPMDocument object type, and we need to know when objects with that value set to 'Yes' are submitted for promotion within a Promotion Request. I can loop through the objects attached to the promotion request object, but I am not sure how to get the attribute value and check to see if it is true or not. Any help will be appreciated.
Thanks,
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator
We don't have the ext.alcon class. Is that custom? What version of Windchill are you running? We are on 10.0 M040.
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator
In Reply to Mike Lockwood:
We do exactly this for the ModelCheck errors (which we label as MC_ISSUES in the info page) attribute using the code shown below.
[cid:image001.png@01CEE6C9.15DB4670]
[cid:image002.png@01CEE6C9.15DB4670]
[cid:image003.png@01CEE6C9.15DB4670]
Steve,
How do you use the LWCNormalizedObject class within a promotion notice? I need to query the IBA values for promotion objects stored within the promotion notice object.
I have the following syntax, within an Expression node, which is working nicely, but I cannot seem to get the IBA value for an attribute associated with the object found during the iteration while loop.
promotionDescription = pn.getDescription().toString();// store the text found in the promotion request description attribute
wt.fc.QueryResult pn_targets = (wt.fc.QueryResult) p.getBaselineItems(pn);
Object myObject = pn_targets.nextElement();
if (objType.equals("wt.epm.EPMDocument")) {
epmObjType = objType.toString();
if (objType.equals("wt.doc.WTDocument")) {
docObjType = objType.toString();
}
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator
I have LWCNormalized Object API in your code to retrieve the IBA value. Check if it works for you
wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject;
promotionDescription = pn.getDescription().toString(); // store the text
// found in the
// promotion
// request
// description
// attribute
wt.maturity.StandardMaturityService p = new wt.maturity.StandardMaturityService();
wt.fc.QueryResult pn_targets = (wt.fc.QueryResult) p.getBaselineItems(pn);
while (pn_targets.hasMoreElements()) {
Object myObject = pn_targets.nextElement();
String objType = myObject.getClass().getName(); // get the internal
// name of the
// parent object
// type
if (objType.equals("wt.epm.EPMDocument")) {
isCAD = true;
epmObjType = objType.toString();
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject((Persistable) myObject, null, Locale.ENGLISH, null);
}
if (objType.equals("wt.doc.WTDocument")) {
isDocument = true;
docObjType = objType.toString();
}
}
Hope this helps !!!!
Thanks,
Shreyas
Simon,
Thanks for the clarification on seeds vs. targets. From what I can tell, in the Windchill 10.0 JavaDoc, the getBaslineItemsmethod is still available, but you access it via wt.maturity.StandardMaturityService. There is a getPromotionTargets method within the StandardMaturityService class that is used for just accessing the targets. I have updated my code, now, to use that method instead.
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator
In Reply to Simon Heath:
Dear All,
Little point on the code, I understood services should be accessed like this
MaturityHelper.service.getBaselineItems(pn)
However I have noticed this API is deprecated (anyone know why or what is the replacement?)
Also note there are two concepts that need to be understood, seeds and targets. Seeds are in the promotion but not marked for promotion, where as targets will be promoted. The baseline contains items that are seeds make sure you get what you want.
Simon
I tried putting your code into mine, but I get errors when checking the syntax. Here is the error I get:
public static boolean checkEvent (Object _event, Object [] _values)
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:79: illegal start of expression
^
public static boolean checkEvent (Object _event, Object [] _values)
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:79: ')' expected
^
public static boolean checkEvent (Object _event, Object [] _values)
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:79: ';' expected
^
public static boolean checkEvent (Object _event, Object [] _values)
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:79: ';' expected
^
throws Exception {
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:80: ';' expected
^
I think it may have to do with the attribute that I am trying to access. It is a boolean attribute. Is there anything special that I have to do to access a boolean vs. a string?
Thanks,
Benjamin Wilcox - IntelliServ<sup>™</sup>
PPM & PDM Administrator
In Reply to Shreyas Atre:
I have LWCNormalized Object API in your code to retrieve the IBA value. Check if it works for you
wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject;
promotionDescription = pn.getDescription().toString(); // store the text found in the promotion request description attribute
wt.maturity.StandardMaturityService p = new wt.maturity.StandardMaturityService();
wt.fc.QueryResult pn_targets = (wt.fc.QueryResult) p.getBaselineItems(pn);
while (pn_targets.hasMoreElements()) {
Object myObject = pn_targets.nextElement();
String objType = myObject.getClass().getName(); // get the internal name of the parent object type
if (objType.equals("wt.epm.EPMDocument")) {
isCAD = true;
epmObjType = objType.toString();
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject((Persistable) myObject, null, Locale.ENGLISH, null);
}
if (objType.equals("wt.doc.WTDocument")) {
isDocument = true;
docObjType = objType.toString();
}
}
Hope this helps !!!!
Thanks,
Shreyas
I found an error in my code -- had forgotten a close }. Now, though, I get a different error:
D:\ptc\Windchill_10.0\Windchill\temp\WfExpression493019533.java:48: cannot find symbol
location: class wt.workflow.expr.WfExpression493019533
^
Syntax check complete.
Any ideas?
Thanks,
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator
Add complet class path for Persistable and local
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject((wt.fc.Persistable) myObject, null, java.util.Locale.ENGLISH, null);
Thanks,
Shreyas
Thank you. That is what I needed. My code is working very nicely, now. Thank you to all for your help!
Benjamin Wilcox – IntelliServ<sup>™</sup>
PPM & PDM Administrator