How to represent **multiple, nested one-to-many relationships** for XML output?

Here’s a view of what I’m trying to produce.

I’m having trouble figuring out how I might represent multiple nested one-to-many relationships in Mockaroo.

I’ve tried mucking about with datasets and multiple element syntax…

Field Name			Type			Options

StateId				Formula			if a + b...
Policy[4].OriginalId		Dataset Column		Policy
Policy[4].OriginalExtractDate	Dataset Column		Policy

… but it’s not working as I’d hoped.


Is it possible to get the following structure using Mock?

<Policy>
  <somepolicyelement>...</somepolicyelement>
  <policyelement2>...</policyelement2>
  <MemberInformation>
    <first>...</first>
    <last>...</last>
    <DOB>...</DOB>
  </MemberInformation>
  <MemberInformation>
    <first>...</first>
    <last>...</last>
    <DOB>...</DOB>
  </MemberInformation>
</Policy>
<Policy>...

… ideally with a varying and random number of sub-elements?

Thanks,
Greg

Hmm… not with XML. The JSON format has the JSON Array type which is similar in concept, but not exactly what you need. I think I can add it though.

I’ve added a new type called “Repeating Element” that works like JSON Array but for XML. Give that a try. It should do what you need.

1 Like