11-24-2023 06:58 AM
Hi everyone,
I have a question related to the upload of a new dimension hierarchy through an XML file.
I currently have a file excel with the whole hierarchy for each dimension that I keep updating based on my client requests.
I noticed that when I upload the file, the system merges the current version of the hierarchy with the previous one. This does not work for me because I would need the old hierarchy to be replaced by the new one.
A possible solution could be to manually delete the hierarchy members before the upload of the new hierarchy, but this would delete the data that has been loaded already. I would need a solution to just overwrite the current relationships between the members of the hierarchy without deleting them.
Is there a way to do that?
Thanks in advance!
Solved! Go to Solution.
11-24-2023 01:01 PM
@fc You can setup the xml's Relationships section to "Delete" a Relationship like this:
<relationships>
<relationship parent="{parent name}" child="{child name}" action="Delete" />
</relationships>
Note that deleting the Relationships may result in Orphaning a member, which in your case is what you want. A member that is Orphaned does not lose/delete its data, so as long as you upload your new file and re-create the new Relationships, your overall data will be unaffected.
11-24-2023 08:48 AM
Hi,
We have a similar use case where we require the hierarchy of a UD to be replaced and not merged. We go with the approach of "Break and Build" using xml to completely replace the existing hierarchy with the new one.
First create a break xml for the metadata by choosing the dimension and removing all relationships so everything gets orphaned and then for the build xml you just need to take an xml extract of the new hierarchy for all the members. Then the hierarchy is built again from scratch, thus replacing with the new structure. Though you do need to careful, as if they are any missed members they would remain orphaned.
Thanks,
Sudarshan
11-24-2023 11:22 AM
What do you mean with "create a break xml"? Is there a fast way to remove all the current relationships in the hierarchy?
11-24-2023 01:01 PM
@fc You can setup the xml's Relationships section to "Delete" a Relationship like this:
<relationships>
<relationship parent="{parent name}" child="{child name}" action="Delete" />
</relationships>
Note that deleting the Relationships may result in Orphaning a member, which in your case is what you want. A member that is Orphaned does not lose/delete its data, so as long as you upload your new file and re-create the new Relationships, your overall data will be unaffected.
11-27-2023 10:35 AM
@fc Referring to what @drgerrow said above.... If you are savvy with VBA, I wrote this function to help myself quickly create the lines of xml code for deleting relationships by referencing the parent and child in the formula. You will just need to get the list of relationships in excel which could be done by extracting out the xml and parse using text to columns in excel.
Here is the code I use for generating the xml lines:
Public Function Remove_Relationships_XML(ParentName As String, ChildName As String) As String
Dim Line As String
Line = Line & "<relationship parent=""" & (ParentName) & """ child=""" & (ChildName) & """ action=""Delete"" />"
Remove_Relationships_XML = Line
Exit Function
End Function
07-04-2024 06:57 AM
could please give more details to put in acction it? I need it in the case of delete members instead of relationships. thanks in advace.