Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Thanks bro for the help it really kind of you
is this what you are looking for? (i changed the field names Parent to supervisor and child to Employee for my understanding).
(i see you want all the non metric fields like BOM Level 1 Code, BOM Level 1 Name, BOM Level 1 Item Group Code etc which i havent written code for the thoses joins yet, this code being a tedious n laborious)
hi @Qrishna thanks but i look for like that
looking for Parent child relation every id wise
ParentItemID | L1 | L2 | L3 | L4 |
1001 | 1002 | |||
1001 | 1003 | 1004 | ||
1001 | 1003 | 1005 | 1006 | |
1001 | 1003 | 1005 | 1007 | 1008 |
1003 | 1004 | |||
1003 | 1005 | 1006 | ||
1003 | 1005 | 1007 | 1008 | |
1005 | 1006 | |||
1005 | 1007 | 1008 | ||
1007 | 1008 |
Please try below:
//---------------------------------------------------//
//----------Update----------//
// 2. Find the Total Quantity for each pathname - Objective2
// 2.1. Split the PathName into individual employee IDs.
PathExploded:
LOAD distinct
PathName,
SubField(PathName, '\') AS Employee
RESIDENT Heirarchy;
// 2.2 Join the quantities to each employee in the path.
LEFT JOIN (PathExploded)
LOAD
employee as Employee,
Qty
RESIDENT Employee;
// 2.3. Aggregate to calculate the total quantity for each path.
left join(Heirarchy)
TotalPathQty:
Load *, SubField(PathName, '\', -1) AS MemberID;
LOAD
PathName,
SUM(Qty) AS TotalQty
RESIDENT PathExploded
GROUP BY PathName
order by PathName;
// Drop the intermediate exploded table if no longer needed.
DROP TABLE PathExploded;
Thanks @Qrishna how about total quantity at lowest level
Will post the script soon for that, as you changed the requirement from that of the original post in you reply, i had to rewrite the entire code and forgot about TotalQty. in the mean time, post the expected Totalqty column values in your table, that would be helpful.
I have attached the file which have requirements
I just updated the code with the Objective2 - TotalQty.
Good luck with your Assignment.!
Thanks bro for the help it really kind of you
No Worries, please close the thread marking the right solution.