cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are working to address an issue with subscription email notifications. In the meantime, be sure to check your favorite boards for new topics.

Using IBA values to route the Work Flows

AlexSaji
4-Participant

Using IBA values to route the Work Flows

I am trying to create a workflow for "Variance" Object . Based on an IBA value enetered by the user, while creating the Variance I am expecting the Work Flow goes on two different routes.


Say for example there is an IBA called "Mfg Site" . IF the value is "Mexico" it needs to take "route1" in the work flow and if this value is "USA" it needs to go through "route2"


I would really appreicate if anyone can give me the routing expression to use for this .


Thanks


Alex.S.F

7 REPLIES 7
avillanueva
22-Sapphire II
(To:AlexSaji)

This method always worked for me:

public String getIBA(String iba, IBAHolder holder)
{
try
{
IBAHolder ibaHolder=IBAValueHelper.service.refreshAttributeContainer(holder, null, null, null);
StandardIBADefinitionService defService=new StandardIBADefinitionService();
DefaultAttributeContainer attributeContainer=(DefaultAttributeContainer)ibaHolder.getAttributeContainer();
AttributeDefDefaultView attributeDefinition=defService.getAttributeDefDefaultViewByPath(iba);
AbstractValueView attValue= attributeContainer.getAttributeValues(attributeDefinition)[0];
return attValue.getLocalizedDisplayString().trim();
}
catch (Exception e)
{
log.error("Something strange has occurred",e);
}
return ";
}

I would pop this into a helper class and call from your conditional robot.

//add this to conditional robot


com.infoengine.SAK.Task task = new com.infoengine.SAK.Task("getAttVal.xml");
String obid = wt.adapter.BasicWebjectDelegate.getUfid(primaryBusinessObject);
obid = obid.substring(0,obid.lastIndexOf(':'));
task.setUsername("wcadmin");
task.addParam("obid", obid);
task.invoke();
com.infoengine.object.factory.Group part = task.getGroup("VarAttsGroupOut");
String attVal = (String)part.getAttributeValue(0, "<logical identifier=" of=" attribute=">");

if(attVal.equals("<val 1=">"))
result="route1";
else if(attVal.equals("<val 2=">"))
result="route2";

//recommended: add default route if above conditions fail




create IE task under <windchill>\tasks with name getAttVal.xml containing following webject

<%@page language="java"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<ie:webject name="Query-Objects" type="OBJ">
<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])" delim="!" valueseparator="!" default="&lt;%=com.infoengine.au.NamingService.getVMName()%">"/>
<ie:param name="ATTRIBUTE" data="&lt;logical" identifier=" of=" attribute=">"/>
<ie:param name="GROUP_OUT" data="VarAttsGroupOut"/">
<ie:param name="TYPE" data="&lt;Var" type=" logical=" identifier=">"/>
<ie:param name="WHERE" data="obid=$(@FORM[]obid[0])"/">
</ie:webject>



Note: There is a way to get IBA values without using IE task.


I hope this helps.

AlexSaji
4-Participant
(To:AlexSaji)

Thanks a lotAntonio and Yogesh ,


I will try this option


Yogesh ,


Do you have any suggetions without using the Info Engine task ?

If you are using 10.0 or 10.1 there are significantly simpler getter/setters available for working with IBA. Note that in 10.1 I think the class name was updated

More info can be found in the javadoc - com.ptc.core.lwc.server.LWCNormalizedObject

Here are some examples

Example usage:

CREATE

LWCNormalizedObject obj = new LWCNormalizedObject("com.acme.AcmePart",null,null);
obj.load("name","number");
obj.set("name","my name");
obj.set("number","12345");
obj.persist();

RETRIEVE
LWCNormalizedObject obj = new LWCNormalizedObject(my_persistable,null,null,null);
obj.load("name","number");
Object nameValue = obj.get("name");
Object numberValue = obj.get("number");

UPDATE
LWCNormalizedObject obj = new LWCNormalizedObject(my_persistable,null,Locale.US,new UpdateOperationIdentifier());
obj.load("attributeA","attribtueB");
obj.set("attributeA",new Boolean(true));
obj.set("attribtueB","PURPLE");
obj.apply();
...
PersistenceHelper.manager.modify(my_persistable);

Replies from Antonio and Jeff would be ways to go to get IBA values without using the Info Engine task.

I've used these and they work very well for getting IBA values and using them in a workflow as well as Setting IBA values from the workflow to the PBO. Very easy and handy to have.

[cid:image001.gif@01CE20B3.EA75DA30]

Steve Vinyard
Senior Solution Architect



Jeff, you shared these before, for create, it appears we can use these on
any type, including the base type, which in theory is the root of all soft
types?



Have you created new objects with these, on update, does it iterate? Some
API's handle this. Just thought I'd clarify. Alternatively, my old IBA API
would let you update these if desired without performing a checkout.



Thanks.






Top Tags