Delete orphan records from a Properties module
I want to change the rollups of Cost Center into its parent Division in hierarchy (i.e. Cost Center 100 belongs to Div 1 today. I want to change to Div 2).
I can make teh change and write the data correctly. But I can't think of an automated way to delete 2 levels of hierarchy under the existing cost center. (i.e. Employees belong to Cost Center. All employees rolling up to Div 1 should now go to Div 2). When I build the new mapping and delete the old cost center rollup, everything underneath it gets orphaned (as it should). But my data is doubling since I now have 2 records.
Does anyone know how to just delete orphan records?
I did a ISBLANK(PARENT(Item) in the Employee properties module. But when I have orphan records, it doesn't show in the module at all. It only shows what's in hierarchy.
@pyrypeura Not sure why but I couldn't see those orphan records in the module. Once teh parent is deleted, they are visible in list, but not module.
@Emmeline That's a good idea, maybe I can try that next time.
For now, I did a comparison of the Parent level with a lookup to the Parent's module and a FIND from the current row's code. When they are not the same, it checked a boolean box. I used that boolean to do a Clear list action. I have to delete everything before I add the new mappings.
Thanks for the help!0
The orphans are also visible in bottom of the module (after the total item). If you don't see any orphans there you have either updated the old cost centers to new parents or already deleted the orphan items.
Maybe you could use number line items to identify parent levels?
For instance, create a line item dimensioned by parent level with "1" as formula. On a second line item, get the 'parent line item number'[lookup : parent]. Then with a boolean, identify items equal to 0: they are orphans. Finally, use an action "delete from list using selection".0