# challenge with column modification

Hi,

I have a requirement where I want to restrict the number of rows of customer and address into three columns

for example my data returns 10 customers and 10 address , I want to break it where I can show 4 customers in column one and two and 2 in column 3. is this possible? any help advice appreciated

0

## Comments

Here is an example:

https://forums.opentext.com/forums/discussion/61121/birt-mailing-labels-example

The example uses a grid to create the columns. Each grid column contains its own table. The tables have filters so that they do not duplicate the data.

Jeff F.Customer Support Engineer I

OpenText

Thanks I have tried to search but didnt find this till you forward it , appreciated,

what I cant get my head around is who to control the number of rows on each column?

in that example there is "row["Row Number"]%3" with the value of 1,2 and 0

thanks

For this method, the number of columns is determined by how many grid columns and tables are manually added. The modulus operator (%) splits the data rows into the columns equally. If there are 3 columns, every third row is placed in the first column. If there are 4 columns, use %4 so that every 4th row is placed in the first column, etc. It is simple coded logic to distribute the data evenly. If you have 10 rows and want 4,4,2, you can change the filters to (the first row is 0):

column 1: row number < 4

column 2: row number > 3 && row number < 8

column 3: row number > 7

Jeff F.Customer Support Engineer I

OpenText

thanks for your explanation Jeff,

this will work if i always have a fix number of rows, how ever lets say the max rows are 10 but (it could be less ) which I didn't think about it when I start this experiment

if max rows 10 then we want 4 - 3 - 3

if max rows 9 then 3 - 3 -3

if max rows 8 then 3 -3 -2

any script or more dynamic logic could presents this options ?

thanks

The mailing labels example in the link I provided does exactly what you asked. Add "fetch first 10 rows only" to the end of the query to test 10 rows.

Jeff F.Customer Support Engineer I

OpenText

thanks