Single formula for different list items
I have a list called Apple having items A,B, A+B. A+B should contain the addition of data of A and B.
In the module i have a line item called data and applies to Apple list. I have to write the logic for Data line item such that the module shows up values for A, B and A+B should have addition of values of A and B. Note- A and B takes values from source module D.
Please can you suggest some ideas.
don't you simply have a parent for A and B in the list ? it will sum0
This is a straitjacket solution that I don't recommend because it will not scale but here's what you can do
1. In a line item get your data against the Apple list from Module D using whatever method you're using now.
Ex: D.Data[SUM: D.Apple]
I will call this line item as Source Data
2. Create another line item with the formula:
IF ITEM(Apple) <> Apple.'A+B' THEN Source Data ELSE Source Data[SELECT: Apple.A] + Source Data[SELECT: Apple.B]
This line item will have the data in the fashion you've specified
The issue with this is if you need A+B+C, you will have to manually edit the formula to add Source Data[SELECT: Apple.C]
Another issue is that this list cannot be made a production list
Let me know if this works for you
Alternatively, as @nathan_rudman mentioned, you can just rename the Top Level or parent of the Apple list to 'A+B' and it will aggregate just fine
You can assign A+B as parent of A ,B items, it will automatically sum up else you can use sourced.value[select item.A]=[item.B]0
Thank you so much, This works.