Table numbering column in Report

I have designed a report with a number column going 1, 2, 3, 4, 5, etc. I need for the report to show 1, 1, 2, 2, 3, 3 etc. I have @floor(Row/2)@ but the numbering starts at 0, instead of 1.

Any help would be greatly appreciated, thank you!

Do you want the report to show 1,1,2,2,3,3 etc in the columns or rows? you say it starts at 1 so I’m assuming rows.

Yes rows, sorry. My report, I currently have @floor(Row/2)@ which starts with 0, then goes 1,1,2,2,3,3 etc. I need for the row to start at 1. :smiley:

you don’t want 0 to show up in your row results, why don’t you just filter that in your WHERE clause?

When making a report, you can use @Row@ to display the row index. It is separate from the data actually being displayed. A where clause relies on the row index being stored in the database as a column, instead of being added on later.

As an example, if there was a table in the database storing car owner, year, color, and style, (with a primary key), it might look something like this when it was displayed.

+-----+--------+------+-------+------+
| 10  | Green  | John | Car   | 2001 |
+-----+--------+------+-------+------+
| 116 | Red    | Ray  | Car   | 1994 |
+-----+--------+------+-------+------+
| 22  | Orange | Tim  | Truck | 2016 |
+-----+--------+------+-------+------+
| 47  | Yellow | Jean | Car   | 2008 |
+-----+--------+------+-------+------+

There is no sort of filtering in a where clause that will get the first column looking like, 1,1,2,2,3,3…

So rather than displaying the primary key in the first column, use the @row@ function from the reporting, which will make the table look like…

+---+--------+------+-------+------+
| 1 | Green  | John | Car   | 2001 |
+---+--------+------+-------+------+
| 2 | Red    | Ray  | Car   | 1994 |
+---+--------+------+-------+------+
| 3 | Orange | Tim  | Truck | 2016 |
+---+--------+------+-------+------+
| 4 | Yellow | Jean | Car   | 2008 |
+---+--------+------+-------+------+

Which still isn’t what is wanted. When trying to use the floor function, the rows still start at 0, and then act in the desired way.

+---+--------+------+-------+------+
| 0 | Green  | John | Car   | 2001 |
+---+--------+------+-------+------+
| 1 | Red    | Ray  | Car   | 1994 |
+---+--------+------+-------+------+
| 1 | Orange | Tim  | Truck | 2016 |
+---+--------+------+-------+------+
| 2 | Yellow | Jean | Car   | 2008 |
+---+--------+------+-------+------+

The question is… how to remove that 0 index, and start at 1 instead. Keeping the table data the same.

Use the ceil() function.

@ceil(Row/2)@

should work

1 Like

try:

@floor((Row+1)/2)@
2 Likes