Voting Example: Two Events
In this example, there is a team with 10 members. The team is designing new shirts for their team uniform.
The team is voting on which colors to use. They are given two routing events:
Blue
Yellow
Every member is a required participant.
WfTally.any
You can vote for blue, yellow, or a combination of blue and yellow.
If any person votes for yellow, then the new shirt is yellow.
If no one votes for yellow, then the new shirt is blue.
Routing Type
Expression
Votes
Outcome
Manual
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.any(self, "Yellow", "Blue");
Yellow 2
Blue 10
Yellow
WfTally.all
You can vote for blue, yellow, or a combination of blue and yellow.
If every person votes for yellow, then the new shirt is yellow.
If one or more people do not vote for yellow, then the new shirt is blue.
Routing Type
Expression
Votes
Outcome
Manual
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.all(self, "Yellow", "Blue");
Yellow 9
Blue 3
Blue
WfTally.percent
You can vote for blue, yellow, or a combination of blue and yellow.
If more than 30% of the team votes for yellow, then the new shirt is yellow.
If less than 30% of the team votes for yellow, then the new shirt is blue.
For information on operators, see Tallying Operator.
Routing Type
Expression
Votes
Outcome
Manual exclusive
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.percent(self, WfTally.GT, 30, "Yellow", "Blue");
Yellow 4
Blue 8
Yellow
WfTally.number
You can vote for blue, yellow, or a combination of blue and yellow.
If 3 or more people vote for yellow, then the new shirt is yellow.
If fewer than 3 people vote for yellow, then the new shirt is blue.
For information on operators, see Tallying Operator.
Routing Type
Expression
Votes
Outcome
Manual
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.number(self, WfTally.GTE, 3, "Yellow", "Blue");
Yellow 3
Blue 8
Yellow
WfTally.plurality
You can vote for blue or yellow, but you cannot vote for both.
If yellow has more votes than blue, then the new shirt is yellow.
If blue and yellow have the same number of votes, then the new shirt is yellow.
If blue has more votes than yellow, then the new shirt is blue.
Routing Type
Expression
Votes
Outcome
Manual exclusive
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.plurality(self, "Yellow", "Blue");
Yellow 5
Blue 5
Yellow
WfTally.notPlurality
You can vote for blue or yellow, but you cannot vote for both.
If yellow has fewer votes than blue, then the new shirt is yellow.
If blue and yellow have the same number of votes, then the new shirt is yellow.
If blue has fewer votes than yellow, then the new shirt is blue.
Routing Type
Expression
Votes
Outcome
Manual exclusive
//Get the object that represents this activity.
WfAssignedActivity mySelf = ((WfAssignedActivity)self.getObject());

//Specify the result.
result = WfTally.notPlurality(self , "Yellow", "Blue");
Yellow 6
Blue 4
Blue
Related Topics
Isto foi útil?