on 04-07-2012 9:44 PM
Hi Experts,
I have requirement like this:
Function input is table of items.
Function output is table of items with costs.
like if i enter
Item Name
item1
item2
as input
The result should be like
ItemName Cost
Item1 100
Item2 200
How could we design this requirement. like what are the expression and in which order we need to use.
I have tried to use the decision table but it is not taking table as a input parameter. It is only allowing element type input parameters.
But i think LOOP expression may use full for my requirement, but i don't know how to design this expression for my requirement.
Thank you,
Srini M
Hi Srini,
Yes!! You need to use Loop & DT Expression..
1. In Function (Functional mode) Signature Create & assign Table1 of structure Item Name Element and for Result Data Object Create & assign Table2 of structure Item Name (don't reuse from Table 1..create again) & Cost Elements
2. Create Loop as Top Expression & Select 'For Each Entry in' type on Table1
3. Create Rule inside Loop and Create Decision Table with Condition columns of Elements of Table1 & Select Table2 as Result data object
4. Change the Update mode (by default 'Change') to 'Insert'
"I have tried to use the decision table but it is not taking table as a input parameter. It is only allowing element type input parameters."
DT works based on Element Input but not as Table Input..therefore you need to use Loop Expression also.
regards, Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Thank you very much for your response. it is very helped for me.
As per your suggestions we have developed application. But with this approach we have issue. Could you please help me on this.
Input context parameters
Project Name AttributeName AttibuteValue
P1 Country Inida
P1 Country South Africa
Output result parameters are
Project Name AttributeName AttibuteValue Status
P1 Country Inida Yes
P1 Country South Africa No
As per the above scenario we have used two different elements for the Item Name and we have entered value for both input Item Name and output Item Name in decision table level.
But here in this case we have to create another there data objects and need to enter instead of 3 parameters we have to enter 6 parameters. In customer perspective that is not looking good.
How could we Achieve this.
We have tried with the following steps.
Step1: We have create data objects Project Name, Attribute name, Attribute Value, Status.
Step2:
We have create Tables
Tab1: with data objects Project name, Attribute name, Attribute Value)
Tab2: with data objects Project name, Attribute name, Attribute Value, Status)
Step3: Created a function with context Tab1 and Result table as Tab2. Assigned LOOP expression as top expression.
Step4: Created Rule inside Loop and Created Decision Table with Condition columns of Elements of Tab1 & Selected Status as Result data object
and update mode as default Change
Step5: If Condition True
Perform the following operations | |||||
| |||||
|
But i am getting result as
Project Name AttributeName AttibuteValue Status
P1 Country Inida ""
P1 Country South Africa ""
If I add one more Assign Value to Context. Like this
(3 ) | Change | Tab2 | from value of | Status |
I am getting like this result
"" "" "" Yes
"" "" "" No
Could you please help me out on this.
Hi Srinu,
What I understand is you have two issue here.
1. Maintenance of duplicate columns
Project Name AttributeName AttibuteValue | Project Name AttributeName AttibuteValue Status
Condition Columns | Result Columns
Instead of doing this you can design your DT like
Project Name AttributeName AttibuteValue |Status
Condition Columns | Result Columns
2. The values are not updating properly in tab2
Inside Loop Expression
(1) Change Structure of Tab2 from value of Structure of Tab1
(2) Change Status after processing DT
(3) Insert values into Tab2 from Structure of Tab2
Hope this should solve your problem.
regards, Rahul
Why two tables?
Instead of working with a result it may also be an option to just pass one table as context with all columns. Then in the loop the empty column is set with the decision table.
A result is not mandatory. Any in some cases it is also perfectly fine just to manipulate the context directly (caller needs to be prepared and take back the changed context).
Hi Carsten/Raghul,
I have resolved the issue.... thxs for the valuable information.
I have created two tables 1. input table 2. Output table..... The difference in the structure are i have placed an extra field (result in the output table).
If i use the same table as input and output .... I could find the result field in the input selction criteria
which doesn't meet the requirement......
Thanks,
Srini. M
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.