I am doing a document split on an xml document, because I need to batch them on parent IDs (for upserting to salesforce), but some records have no parent, and they seen to not be returned from the split. Is this expected behaviour?
It depends on what is the xml element based on which you do the splitting. If you are splitting based on the parent ID, you will not get the records which do not have the parent ID.
So basically I need to set a default parent value and the remove it after the split? I am actually splitting on two values, where the first one filters away the empty ones after, but I actually need the records that have now value on the second field.
Can you share your xml with some sample? And point out what is your splitting element. it would help to understand your problem better and suggest a solution.
I think Adam answered it, but just for clarity:
I retrieve a set of updated records from a database with a structure like this:
Id, AccountId, ParentId, Values...
I have to sort away some records based on the accountid (after a lookup to a list of deployed accounts), as they are not yet deployed to the target system.
I then have to split on the parentid to make sure I upload those without parents first, so I avoid reference errors.
What I did before was to map it to the target xml profile first and then try to split it, which did not work.
It seems the solution is to first map it to a flat file profile (including the lookup) and then split on the two values before mapping to the target xml profile.
Thanks for the help.
I don't believe the XML split behaves this way (grouping by like value). Generally it is used to split the document by a repeating element as part of the schema, for example:
<orders> <order> <-- SPLIT BY THIS ELEMENT <id>123</id> ... </order> <order> <id>456</id> ... </order> ...</orders>
Because this is not an intended use case it does not surprise me that results are "unexpected" and certain subsections are omitted. I was able to reproduce the behavior in a test on my side.
Instead for this use case, I would suggest mapping to a simple intermediate Flat File profile with the elements you need because the Flat File split DOES perform this type of split-and-group-by-value that you are looking for.
Retrieving data ...