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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Workflow conditional expressions

rstav
1-Newbie

Workflow conditional expressions

Windchill Admins,

I have a custom workflow that I am trying to add a
conditional statement to one of the activities or a conditional router
node. I would like to use a particular attribute to control the path of
the workflow using the conditional statement. The attribute is attached
to a WTDocument SubType which is also the PBO.



If I open the activity in the Workflow Process Manager and go to the
Routing Tab and change the Routing Type to Conditional. Now I am able
to type in my three conditions, Repeat, Revised, or New.



I am not sure where to go from here.



Any suggestions



Thanks for you help

Rich



Richard Stavish
Pro/E System Administrator
Sargent Controls & Aerospace



E-mail:
Office:
Fax:

RStavish@sargentcontrols.com
520-744-1000 Ext. 570
520-744-7529
3 REPLIES 3
dwilliams
6-Contributor
(To:rstav)

Here is an example of a conditional you could use.

wt.doc.WTDocument dO = (wt.doc.WTDocument) primaryBusinessObject;

wt.iba.value.IBAHolder ibaHolder = (wt.iba.value.IBAHolder)dO;

ibaHolder = wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, null, null);

wt.iba.value.DefaultAttributeContainer attributeContainer = (wt.iba.value.DefaultAttributeContainer)ibaHolder.getAttributeContainer();

wt.iba.definition.service.StandardIBADefinitionService defService = new wt.iba.definition.service.StandardIBADefinitionService();

wt.iba.definition.litedefinition.AttributeDefDefaultView attributeDefinition = defService.getAttributeDefDefaultViewByPath("AttributeNameHere");

wt.iba.value.litevalue.AbstractValueView svc = attributeContainer.getAttributeValues(attributeDefinition)[0];

java.lang.String svcString = svc.getLocalizedDisplayString();

if (svcString.equals("Value1Here"))
{
result = "Route1Here";
}

else if (svcString.equals("Value2 Here"))
{
result = " Route2Here";
}

else if (svcString.equals("Value3 Here"))
{
result = "Route3Here";
}

else if (svcString.equals("Value4 Here"))
{
result = "Route4Here";
}

Hope this helps,

Dax Williams
Business Administrator, Windchill
Lifetime Products, Inc.
-<">mailto:->

[cid:image002.jpg@01C9A18C.3246BD80]
pkurtz
1-Newbie
(To:rstav)

To add to the previous replier:

The routing options on the left are all mapped to the string variable
"result".

So you need to make the conditional field apply a value to result in some
manner. This can be as easy as just having another variable equal result,
for example

If (myIteration = 5){
result = "Repeat";
}


To get the IBA value, you can do something like was described by Dax, I just
thought I'd reply with something a bit more simple.

If you have any more questions, I have a function that can do similar things
to what he described as well, a little cleaner

Patrick Kurtz
Consultant
ProductSpace Solutions Inc.
"Your Products to the Nth Power"
630.495.2999 Ex 8110


On Tue, Mar 10, 2009 at 2:11 PM, Stavish, Richard <
rstavish@sargentcontrols.com> wrote:

> Windchill Admins,
>
> I have a custom workflow that I am trying to add a conditional
> statement to one of the activities or a conditional router node. I would
> like to use a particular attribute to control the path of the workflow using
> the conditional statement. The attribute is attached to a WTDocument
> SubType which is also the PBO.
>
>
>
> If I open the activity in the Workflow Process Manager and go to the
> Routing Tab and change the Routing Type to Conditional. Now I am able to
> type in my three conditions, Repeat, Revised, or New.
>
>
>
> I am not sure where to go from here.
>
>
>
> Any suggestions
>
>
>
> Thanks for you help
>
> Rich
>
>
>
> *Richard Stavish** **
> *Pro/E System Administrator
> Sargent Controls & Aerospace
>
> E-mail:
> Office:
> Fax:
>
> RStavish@sargentcontrols.com
> 520-744-1000 Ext. 570
> 520-744-7529
>
>
dwilliams
6-Contributor
(To:rstav)

Ravin,
I apologize for the delay in response. We are currently doing this by using a "ResponsibleTeam" string variable that is required upon creation of the object. The discrete set values of the "ResponsibleTeam" variable are the team template names. The users select the responsible team upon creation and the code below is used in an expression robot to re-team the object based on their selection.

wt.change2.WTChangeIssue cO = (wt.change2.WTChangeIssue) primaryBusinessObject;
wt.iba.value.IBAHolder ibaHolder = (wt.iba.value.IBAHolder)cO;
ibaHolder = wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, null, null);
wt.iba.value.DefaultAttributeContainer attributeContainer = (wt.iba.value.DefaultAttributeContainer)ibaHolder.getAttributeContainer();
wt.iba.definition.service.StandardIBADefinitionService defService = new wt.iba.definition.service.StandardIBADefinitionService();
wt.iba.definition.litedefinition.AttributeDefDefaultView attributeDefinition =defService.getAttributeDefDefaultViewByPath("ResponsibleTeam");
wt.iba.value.litevalue.AbstractValueView svc = attributeContainer.getAttributeValues(attributeDefinition)[0];
java.lang.String svcString = svc.getLocalizedDisplayString();
Vector v=wt.team.TeamHelper.service.findTeamTemplates(cO.getContainerReference ());
for (int i=0; i<v.size();i++)<br/>{
wt.team.TeamTemplateReference tt=(wt.team.TeamTemplateReference)v.get(i);
if (tt.getName().equals(svcString))
{
wt.team.TeamHelper.service.reteam(cO,tt);
}
}

We have gone one-step further by requiring the users to specify a "ResponsibleRole" string variable from a discrete set value list. We take the user from the "ResponsibleRole" and add them into the Owner role where the owner role is on the team template with no previous participants. The adding of the user is done with the following robot expression:

wt.change2.WTChangeIssue cO = (wt.change2.WTChangeIssue) primaryBusinessObject;
wt.iba.value.IBAHolder ibaHolder = (wt.iba.value.IBAHolder)cO;
ibaHolder = wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, null, null);
wt.iba.value.DefaultAttributeContainer attributeContainer = (wt.iba.value.DefaultAttributeContainer)ibaHolder.getAttributeContainer();
wt.iba.definition.service.StandardIBADefinitionService defService = new wt.iba.definition.service.StandardIBADefinitionService();
wt.iba.definition.litedefinition.AttributeDefDefaultView attributeDefinition = defService.getAttributeDefDefaultViewByPath(ResponsibleRole);
wt.iba.value.litevalue.AbstractValueView svc = attributeContainer.getAttributeValues(attributeDefinition)[0];
java.lang.String svcString = svc.getLocalizedDisplayString().toUpperCase();
wt.project.Role to_role = wt.project.Role.toRole(OWNER);
wt.project.Role from_role = wt.project.Role.toRole(svcString);
wt.team.Team team = (wt.team.Team)((wt.team.TeamManaged)(self.getObject())).getTeamId().getObject();
java.util.Enumeration participants = team.getPrincipalTarget(from_role);
while(participants.hasMoreElements())
{
wt.org.WTPrincipal wtprincipal = ((wt.org.WTPrincipalReference)participants.nextElement()).getPrincipal();
wt.team.TeamHelper.service.addRolePrincipalMap( to_role, wtprincipal, team );
}

I am very thankful for all the excellent help I have received from the users on here, which have contributed to this solution for us. Please keep in mind that there might be better ways of doing this and better coding techniques than I have shown here. This is only an example of what is working for us.

Hope this helps,
Dax Williams
Business Administrator, Windchill
Lifetime Products, Inc.
-<">mailto:->

[cid:image001.jpg@01C9A3E3.D62E9310]
Top Tags