Forum Discussion
expat
12 years agoOccasional Contributor
Thanks for the test script. Yours seems to work in the same way that mine does. There is however one, certainly important difference.
In your raw request you I can see you are referencing the two seperate persons (1 & 2) directly. This is not what i am doing, which makes me think that i have explained my issue poorly.
I will try another way, just to see if we are talking about the same thing.
Below is a straight forward form, this i can parameterise with my datasource and iterate through it.
However, what i am thinking is that i have a form that looks like this:
Now if i use the datasource it will pick the same name for the firstname in section 1 and 2. I am trying it to iterate the datasource, so if i wanted to i could just add 10 name sections to the XML and it would use the first 10 rows of the datasource. Instead of filling out each form with the data from the same row.
From what i can see using the Template, Script, Template method i would have to reference each of the individual templates for each item. it would look like this:
Is that correct?
So if i built a form with 100 name sections, i would have to create 100 datagen references to match?
Is there any easier way to do this, to get the datasource to add row 1 into the first set, row 2 into the second set etc. So i can just copy paste as many XML sections i like and the code will do the rest?
Does that make any sense at all. Am i correct in my conclusion of how the DataGen (template, script, template) is working?
In your raw request you I can see you are referencing the two seperate persons (1 & 2) directly. This is not what i am doing, which makes me think that i have explained my issue poorly.
I will try another way, just to see if we are talking about the same thing.
Below is a straight forward form, this i can parameterise with my datasource and iterate through it.
<person>
<name>
<firstname>John</firstname>
<lastname>Doe</lastname>
</name>
<level>
<class>1 A</class>
</level>
</person>
<person>
<name>
<firstname>${DataSource#firstname}</firstname>
<lastname>${DataSource#lastname}</lastname>
</name>
<level>
<class>${DataSource#class}</class>
</level>
</person>
However, what i am thinking is that i have a form that looks like this:
<person>
<name>
<firstname>${DataSource#firstname}</firstname>
<lastname>${DataSource#lastname}</lastname>
</name>
<name>
<firstname>${DataSource#firstname}</firstname>
<lastname>${DataSource#lastname}</lastname>
</name>
<level>
<class>${DataSource#class}</class>
</level>
</person>
Now if i use the datasource it will pick the same name for the firstname in section 1 and 2. I am trying it to iterate the datasource, so if i wanted to i could just add 10 name sections to the XML and it would use the first 10 rows of the datasource. Instead of filling out each form with the data from the same row.
From what i can see using the Template, Script, Template method i would have to reference each of the individual templates for each item. it would look like this:
<person>
<name>
<firstname>${DataGen#name1}</firstname>
<lastname>${DataGen#name1}</lastname>
</name>
<name>
<firstname>${DataGen#name2}</firstname>
<lastname>${DataGen#name2}</lastname>
</name>
<level>
<class>${DataSource#class}</class>
</level>
</person>
Is that correct?
So if i built a form with 100 name sections, i would have to create 100 datagen references to match?
Is there any easier way to do this, to get the datasource to add row 1 into the first set, row 2 into the second set etc. So i can just copy paste as many XML sections i like and the code will do the rest?
Does that make any sense at all. Am i correct in my conclusion of how the DataGen (template, script, template) is working?
Related Content
- 5 years ago
- 4 years ago
Recent Discussions
- 2 days ago