2

I have an attribute table controlled by Atlas on map composer from QGIS. I need to adapt the table for each map and its features but from bottom. In other words, I need to make grow the table from bottom to top. By default table grows from top to bottom

1 Answer 1

3

If you want the table to dynamically change its location relative to other objects (including growing from the bottom), you have to:

enter image description here

  1. Set the "Reference point" to the bottom part.
  2. Set the dynamic height of table1 and table2 in the Position and Size settings using the following expression:

6.2 + 6.2 * (1 + aggregate(layer:='table2', aggregate:='count', expression:= fid))

Where 6.2 is the height of the cells with field names. The second value 6.2 is the height of cells with values that are multiplied by the number of these cells in the corresponding table.

  1. To make the tables not to overlap, you need to set table1 to dynamically change the Y-coordinate, using the expression:

279 - 6.2 * (1 + aggregate(layer:='table2', aggregate:='count', expression:= fid))

Where 279 is the Y value of table2 (bottom) with a slight shift.

enter image description here

6
  • So greatfull for the answer but something is going wrong. I just work with one table so I guess 3rd point is not necessary. I have followed your indications exactly but table behaves as by default. This means table still grows from top to bottom. Just for knowing, I have related two tables so one is driving the atlas and the other goes as a children relation regarding attribute table. Migth change behaviour of your approach?
    – Coldon
    Apr 22, 2021 at 11:11
  • @Coldon May I ask for your project to check it out? Apr 22, 2021 at 12:12
  • @Coldon The point of all this is that the height of the table automatically adjusts to the number of rows (while the table is fixed to one of the lower boundaries). Apr 22, 2021 at 12:17
  • Problem might be on the layer I am setting on the function. Instead of setting the layer that control Atlas I should set the layer related shown on the table. I am not finding the right sintax. Any suggestion? 6.2 + 6.2 * (relation_aggregate(layer:='sectors_finques', aggregate:='count', expression:= fases))
    – Coldon
    Apr 23, 2021 at 8:25
  • @Coldon Try to add quotes:expression:='fases' Apr 23, 2021 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.