How to Generate XML Files with Multile Child nodes using Test Data Manager TDM
search cancel

How to Generate XML Files with Multile Child nodes using Test Data Manager TDM

book

Article ID: 200563

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

We have a requirement to generate XML file which has the below structure

<A>
  <B>
     <C>
         <D>
         <E>
     </C>
     <C>
         <D>
         <E>
     </C>
     <C>
         <D>
         <E>
     </C>
        .
        .
        .
</B>
</A>

The structure
     <C>
         <D>
         <E>
     </C>  is getting repeated N number of times. 

I uploaded this XML and created derived tables. If I wanted to have 100 repetitions of the above-mentioned structure then in CA TDM tool I have to configure 100 rows for <C><D><E>.
Is there any way this can be handled by a single row of configuration?
We need this structure to repeated as many times as needed.

Environment

TDM 4.9X , 4.10.x
Test Data Manager

Cause

N/A

Resolution

This is a tricky problem. from the child table, you are referencing the first published row in the parent table.

What you need to do is to ensure that in the child table col referencing the parent table, you should make sure that you are dynamically updating the ref value based on the published row.

In your example, you have 3 Cs and in each C you have one D and one E
     <C>
         <D>
         <E>
     </C>
     <C>
         <D>
         <E>
     </C>
     <C>
         <D>
         <E>
     </C>  

Here is a simplified solution to your problem
Using your data definition window for table C, create 3 rows.

D and E will have each one row and the table publish count should be set to 3. 

Now from D and E, you need to refer to one of the rows in C depending on the PUBROW value for D and E. 

Let's focus on D for an example ...
C has a primary key called ID
D has an FK relationship called ID_C to ID in C 
in col ID_C I would use ^C.ID(~PUBROW~)^

during publish 
3 rows are generated for C
3 rows are generated for D. however each row in D will reference a different row in C as we used ~PUBROW~ 

 

 

Additional Information

suppose you have variable ~numberOfCs~ = 1000
you use table repeat count for C as ~numberOfCs~
You only create one row for C in the data definition window
 
Since you have one D for each C then you also need to table repeat count for D as ~numberOfCs~
 
 
in D you still refer to C like  ^C.ID(~PUBROW~)^
 
during publish, we generate 1000 rows for C with row number going from 1 to 1000
 
Next, publish for D starts. for each row being published for D, we are referencing a different from in C .. it is like a one to one relationship.
 
This  will give 
<C>
         <D>
  </C>
     <C>
         <D>
     </C>
     <C>
         <D>
     </C>    
     <C>
         <D>
     </C>     

     <C>
         <D>

     </C>    
.... 
 
The same applies to E so I ignored it in this example
 
Next level:
let's  go one step higher and say you want two Ds for each C. You also want a 1000 Cs
in this case ...
table repeat count for C is  ~numberOfCs~
table repeat count for D is @multiply(~numberOfCs~, 2)@
 
the FK ref col in D should have @group(~PUBROW~, 2)@

Attachments

1601471092384__inputexample.xml get_app