12

I need some help with QGIS print composer. I use the atlas composer and I try to use add attribute table from layout tab.

I have create my expression where I want to print in composer.

field expression (that I want):

case when "myfield" is not null   then concat(myfield,' ',myfield1,' & ',myfield2) else concat(myfield1,' ',myfield3)

I have defined filter from item properties where I want to print with atlas:

intersects(buffer($geometry),50),$atlasgeometry)

but that shows like this:

value1
value2
value3
value4
value5
value6
value7
value8
value9

because of to many values I can't print them all in my layout. I need a result like this:

value 1   value2
value 3   value4
value 5   value6
value 7   value8
value9

If the values are like this then I can print all. If I want to add a legend then have option where you can choose columns

columns

That is what I need for my attributes but I can't find something like this.

Finally I try to create a new expression with my field and I try to add next feature but without success.

I tried this:

dbvaluebyid('test','f_field', @row_number ) ||'' ||dbvaluebyid('test','f_field', @row_number +1)

but from this expressions I don't take next feature.

and this:

case when "myfield" is not null   then concat(myfield,' ',myfield1,' & ',myfield2) else concat(myfield1,' ',myfield3)  end ||  '                                    ' || case when "myfield" is not null   then concat(myfield,' ',myfield1,' & ',myfield2) else concat(myfield1,' ',myfield3)

any idea?

  • Have you tried the mode "Repeat until finished" in Item Properties > "Frames" > "resize mode:"? – Kleber Barcelar May 4 '17 at 14:06
  • 2
    Have you tried creating a second attribute identical to the first, but filter the first attribute table to the first 5 records and the second attribute table to the last four records? – Knightshound May 4 '17 at 14:11
  • @KleberBarcelar that is not frame is attribute table I don't have option resize mode – jessie jes May 4 '17 at 19:30
  • @Knightshound I want to have double values export for per line that export is the result of filter – jessie jes May 4 '17 at 19:32
  • 1
    @KleberBarcelar Repeat until finished show me new values in new empty page – jessie jes May 4 '17 at 20:01
1

I found a way, but it's not really interactive for the moment. However, it allows some nice tweaks to have a pretty table displayed :

In QGIS

  • Export your table in Excel

In Excel or similar

(Maybe this part could be automated in Excel)

  • Filter the data if needed to have the table of your desire

  • Create a new set of column after the first ones

  • Cut and paste the extra records to the right of the first ones

  • Get some style to your table

Table transform

In Word or similar

  • Copy and paste your new table into a word document (check the display)

  • Save as an html document if it's ok

HTM word

Text Editor

  • Open the html file in a text editor (for example : Notepad ++)

  • Copy the HTML code

Back in QGIS

  • Create an HTML frame in your QGIS composer and paste the HTML code

Last step in QGIS

Now you have your data in 2 columns.. with style :)

  • I guess they must be better solution to try and keep the link with the original table and/or regenerate automatically the html. But it probably requires some coding to export directly the qgis table into an html code. – gisnside Aug 17 '17 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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