2
Answers

Update nested layer using loop #Challenge

Gautam Parmar

Gautam Parmar

7y
180
1
There is Master Part 1 and to create it two raw materials are required
M1 - 500 Rs.
M2 - 750 Rs.
 
If we change the price of raw materials of M1 500 Rs to 600 Rs. so the cost of master part 1 is now 1350.
 
And in a hierarchy, as you can see to create Master part 2 as a raw material used as master part 1 - so that price of master part 2 will also get affected.
 
and to create Master part 6 as raw material Master part 2 is used to it will also get affect and it is so on an nth number it is not defined how much deep it could be.
It suppose to update all price of raw material which is in hierarchy
 
Answers (2)
2
Nitin Sontakke

Nitin Sontakke

NA 11.7k 2.2k 7y
I understood what you are saying, but didn't understand what is it that you are seeing as a problem. 
 
Where is the data? Is it in the database? You haven't mentioned that. Because the existing data structure is the key to the solution and which is not mentioned anywhere.
 
Because you want to reflect modified price everywhere it is not a problem (again depending on data structure).
 
Please share more details. 
1
Gautam Parmar

Gautam Parmar

NA 872 2.2k 7y
Database structure is RawmaterialPrice Table will have details of price of that particular material, there is two field that is currentPrice & PreviewPrice(They will change price and until click on live button currentPrice price will not update current field)
 
And another table is for MaterialToCreateProduct
 
It will have entries of which material are used to create this product.
 
Here is live example which I shared in one of discussion
  • M1(Bulb inside the red tap) is RawMaterial which price of Rs.500 and if we change to 550.
  • MasterPart1(Red Tap with light) Is final Product & Rawmaterial as well price will get the effect.
  • MasterPart2 (Switch) is final product & raw material as well will also get the effect.
  • Based on MastertPart 2 Part MasterPart 6 price also will get the effect.
I Hope it makes clear,
 
Challenges Here :
 
How to loop all layers inside another, If we loop how to track which hierarchy we are looping and which are to be loop.
 
I cannot update all pricing due to the performance issue or we are having more than 1lc material.