Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I would like to create a hierarchy for the below scenario
Top level is Country Head like below
Country Head
->State Head
->City Head
->Area Head
Country Head | State Head | City Head | Area Head |
Mario | Mario | Mario | Mario |
Mario | Sara | Sara | Sara |
Mario | Sara | Peiris | Peiris |
Mario | Sara | Peiris | Dumi |
Mario | Sara | Peiris | Rashm |
Mario | Sara | Peiris | Randa |
Mario | Saura | Saura | Saura |
Mario | Saura | Chaim | Chaim |
Mario | Saura | Chaim | Nira |
Mario | Saura | Chaim | Ovitiga |
Mario | Saura | Chaim | Sani |
replace the TREE_VIEW Table code like below to get the Hierarchy as you expected.
TREE_VIEW:
LOAD Distinct StateHead as VALUE, StateHead & '-StateHead' as NODE_ID , CountryHead & '-CountryHead' as PARENT_NODE_ID resident ORGANIZATION;
LOAD Distinct Cityhead as VALUE,Cityhead & '-Cityhead' as NODE_ID, StateHead & '-StateHead' as PARENT_NODE_ID resident ORGANIZATION;
LOAD Distinct Areahead as VALUE,Areahead & '-Areahead' as NODE_ID, Cityhead & '-Cityhead' as PARENT_NODE_ID resident ORGANIZATION;
LOAD Distinct CountryHead as VALUE,CountryHead & '-CountryHead' as NODE_ID, CountryHead & '-CountryHead' as PARENT_NODE_ID resident ORGANIZATION;