How loop the static field

If I have an initial value of 3 that parameter named INDEX, how do I loop  the static filed  3  times?

 

Parameter : INDEX=3.

The report will show:   Field_1 ,Field_2,Field_3;

 

Parameter : INDEX=5

The report will show:   Field_1 ,Field_2,Field_3,Field_4, Field_5;

 

Sean.Guo's picture
Joined: Jul 12 2013 - 1:40am
Last seen: 5 years 4 months ago

1 Answer:

1. Create a Variable, for example, called [TestList], expressions like:

java.util.Arrays.asList(
    "Field_1","Field_2","Field_3","Field_4","Field_5"
)

2. Create a Parameter called [ListSize], type Integer.

3. Create a Textfield, use this code to print the list, the printed list item is based on your parameter [ListSize] input.

$V{TestList}.subList(0,$P{ListSize})

riodavid's picture
2987
Joined: Oct 27 2016 - 1:57am
Last seen: 4 years 11 months ago
Feedback