Desktop Client: How to have different decision percentages based on the value of an attribute?
The simplest method to have a complex decision, based on the value of an initial decision in an attribute, is to have more than one decision shape. However, you can also have user-defined functions keep decision values, and use those in a decision expression.
Consider the following example: If attribute "T.smoking" = 'yes', then the percent allocated down the 3 available paths is 30%, 50% and 20%. However, if the attribute "T.smoking" = 'no' then the percents are 20%, 30% and 50%. The simplest method to do this is multiple decisions. You have have one decision that uses an expression that checks the attribute, and sends the transaction to different decisions that have the outputs set at the proper percentages.
If you don't want to see the multiple decisions in your diagram, you can place the decision logic in a subprocess and link to it from a single decision shape. If you would rather do all the decision-making within one decision, and make the distribution percentages vary based on the value of the attribute, you can use some User Defined functions to create the distributions of interest (30,50,20 and 20,30,50), and then refer to them in a Decision Expression on the decision shape; based on the value of a transaction attribute.
The expression might look like the following: If(T.smoking = yes,SmokerPath(),NonSmokerPath())
This is where the two user-defined functions (from the Model menu, choose functions) are numeric functions that return either zero, one, or two (0, 1, or 2 respectively) based on the percentages you want. The key here is knowing that the function must return 0 to go down the First path, 1 for the Second and 2 for the Third. In other words, the paths are zero based indexing. The zero equates to No or False or the First path; one equates to Yes or True or the Second path, and so on.
That is why there are numbers next to the path in the decision type for the Outputs page of the properties dialog; to indicate zero-based indexing. The other key information to understand is that in user-defined functions, the %'s build on themselves when defining the function. So the first distribution is 30, 80 (30+50), 100 (30+50+20). The second is 20, 50 (20+30), 100 (20+30+50). Products this solution applies to: iGrafx Process, Process for Six Sigma.