Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table like:
Item | Comp | Amount |
---|---|---|
1 | A | 11 |
1 | B | 4 |
Now I want one more record for all comp (A,B here) which is a calculated one (say Item ->Calc3) like
Calc3 = Item->1*2
So out put should be like:
Item | Comp | Amount |
---|---|---|
1 | A | 11 |
Calc3 | A | 11*2=22 |
1 | B | 4 |
Calc3 | B | 4*2=8 |
Note: In real scenario, there would be many more items and comps
Please help.
Try this,
Data:
Load Item,Comp,Amount
From xyz;
Concatenate
Load Item,Comp,Amount*2 as Amount
Resident Data;
Regards,
Kaushik Solanki
Thanks Kaushik for your reply. However,
sorry, i should have mentioned that it would be Item specific rather than all items. Say there are 100 items, and I want 101st item to be like that (Calc3 = Item ->1 *2)
i think there will be another field that it indicates last item, for example date...can you please mention that....
Kaushik's answer is OK.
Add a WHERE statement if the computation should be done on some items only.
Fabrice
Prem,
No it's not about last item. It is simply about creating a new record which has a reference to another/more records. It may be like:
Input:
Item Comp Amt
1 A 1
1 B 2
2 A 3
2 B 4
Output:
Item Comp Amt
1 A 1
Calc3 A (amt of item->1)*2 =2
1 B 2
Calc3 B (amt of item->1)*2 =4
2 A 3
2 B 4
Hope, it's bit clearer.
What are the items ? How do you catch them ?
Fabrice
Nope ! Let me rephrase it:
Create a new RECORD which is calculated against some other records:
Like,
Input:
Item
1
2
3
Output:
Item
1
2
3
4 // 4 is calculated like item1+item2
Try this,
Data:
Load Item,Comp,Amount
From xyz;
Concatenate
first 10 Load Item,Comp,Amount*2 as Amount
Resident Data;
Regards,
Kaushik Solanki