Skip to main content
November 24, 2023
Solved

OS metadata

  • November 24, 2023
  • 4 replies
  • 0 views

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!

Best answer by drgerrow

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.

4 replies

November 24, 2023

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

fc5Author
November 24, 2023

What do you mean with "create a break xml"? Is there a fast way to remove all the current relationships in the hierarchy?

drgerrowAnswer
November 24, 2023

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.

November 27, 2023

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

 

July 4, 2024

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.