on ‎2014 Jun 11 4:58 PM
Hi Experts,
I have a situation wherein I want to input a table (as context) and output a table (as result). I have gone thru various forums (SCN included) and the general impression I get is that this is possible. However I have tried various options (loops, temporary variables with initialization etc.) but haven't got the results I am expecting.
The first thing I tried was a simple table input (the table had just one column but multiple rows, each cell of the table had an individual's name e.g if there are three rows in the table then each row contains one individual's name e.g John, Sarah and Michael).
So my input table looks like
| User |
|---|
| John |
| Sarah |
| Michael |
I used this table as context and then within the function I used a decision table (similar to one below) to find colors
| User | Color |
|---|---|
| John | Violet |
| John | Indigo |
| John | Blue |
| Sarah | Green |
| Sarah | Yellow |
| Michael | Orange |
| Michael | Red |
Now when I executed the simulation using input "Sarah" in the context. the output I get is a table output similar to one below (which is good)
| Color |
|---|
| Green |
| Yellow |
However now I want to run a loop where the system first takes John as input context, processes the decision table, then takes Sarah as input context and processes the decision table and finally takes Michael as input context and then processes the decision table.
I expect that the final result should be a combination of all outputs (for each individual iteration) and should look like below
| Color |
|---|
| Violet |
| Blue |
| Indigo |
| Green |
| Yellow |
| Orange |
| Red |
However in actuality, when I run the loop, I get the following output
| Color |
|---|
| Orange |
| Red |
When I see the simulation steps, I see that the system did actually run 3 iterations (one each for John, Sarah and Michael) and calculated the correct result for each iteration but when it presented me the final result, it showed only that of the last iteration (for Michael) and hence I see only the Orange and Red as final output instead of all the colors.
Is it possible to see the output (combination of all three iterations). Please advise.
BR,
Surya
Request clarification before answering.
Hi Surya,
I just implemented your scenario and I think I know where the problem is located:
The function has as context the list of the users (data object table) and as result object a table which consists of the colors:
The assigned ruleset consist of one rule that changes the result data object after processing a loop expression
The loop itself simply iterates over each entry in the user list and calls a decision table which has the setting "Return all matches found":
The crucial point is here that the rule is defined as inserting into the result data object after processing the decision table. This leads to an append of the result values to the table.
You also have the option to change the table which will lead to an overwriting of the existing entries:
In your case i guess you have the CHANGE of the result data object as in this case my function only delivers the values of the last iteration whereas the INSERT into the result data object delivers the result as you described and expected.
BR
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Surya,
that is for sure possible. It is a little bit difficult to figure out the bug in your rules. Can you perhaps post screenshots of how you iterate over the input table and evaluate the decision table and how you modify the result table.
I would guess that you overwrite the result of your decision evaluation in each loop iteration. You should make sure that you use an insert into the result table instead of changing it
BR
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.