Hi,
I need some help in order to find the right syntax to write the code for a Decide function(process flow) .
I have successfully written the code with several conditions but i want to push back the limit a bit by being able to redirect the token item to the connector assigned to it in the Excel File, and that is where i am stuck, cant seem to have the right logic ...
Here is a sample of the Excel file i use :
IDmenuiserie | NumCadre | Famille | Type | CU |
1 | 1 | Accessoire1 | Dormant | 4 |
1 | 6 | Accessoire1 | Ouvrant | 4 |
30 | 89 | Coulissant | Ouvrant | 2 |
30 | 90 | Coulissant | Dormant | 2 |
23 | 82 | Frappe | Ouvrant | 3 |
23 | 47 | Frappe | Dormant | 3 |
the first code i have tried for multiple conditions is this one :
Object current = param(1); treenode activity = param(2); Token token = param(3); treenode processFlow = ownerobject(activity); Variant case_val1 = token.Produit.Type; Variant case_val2 = token.Produit.Famille; Variant Connector = 0; if (case_val1 == "Dormant" && case_val2 == "Coulissant") { Connector = 2; } if (case_val1 == "Ouvrant" && case_val2 == "Coulissant") { Connector = 3; } if (case_val1 == "Dormant" && case_val2 == "Frappe") { Connector = 1; } if (case_val1 == "Ouvrant" && case_val2 == "Frappe") { Connector = 2; } if (case_val1 == "Accessoire*") { Connector = 4; } return Connector;
it works, but like i said i want to be able to use the variable defined in the data table "CU" for the connector.
Therefore i have tried this, to no avail...
Object current = param(1); treenode activity = param(2); Token token = param(3); treenode processFlow = ownerobject(activity); Variant case_val1 = token.Produit.Type; Variant case_val2 = token.Produit.Famille; Variant Connector = 0; for(int i=1; i<=Table("ProcessFlow/Source%").numRows; i++) { if (case_val1 == "Dormant" && case_val2 == "Coulissant") { Connector = token.Produit.CU; return Connector; } if (case_val1 == "Ouvrant" && case_val2 == "Coulissant") { Connector = token.Produit.CU; return Connector; } if (case_val1 == "Dormant" && case_val2 == "Frappe") { Connector = token.Produit.CU; return Connector; } if (case_val1 == "Ouvrant" && case_val2 == "Frappe") { Connector = token.Produit.CU; return Connector; } if (case_val1 == "Accessoire*") { Connector = token.Produit.CU; return Connector; } }
I will attach the fsm and xls file to the this question.