Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change data source of an attribute table frame with data-defined override button #36195

Open
GeoGyro opened this issue May 5, 2020 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks

Comments

@GeoGyro
Copy link

GeoGyro commented May 5, 2020

Context

Switch data source of an attribute table frame in a composer with data-defined override button to take into account if a layer's name changed.

Description

In a composer build with an attribute table frame, data-defined override button don't apply when trying to change the data source.

As documentation specify, data-defined override button allows to dynamically change the layer which is used to populate the table, but changes are not applied.

The source layer reference in the main drop-down list stays persistent, even if @layer_name or @layer_id are changed in expression builder. Same behaviour observed with Geopackages and Shapefiles.

Expressions tryed to define an other source layer (e.g myLayer_1 and myLayer_2) :
'myLayer_2'
@layer_name = 'myLayer_2'

Expressions tryed to switch between two layers (e.g myLayer_1 and myLayer_2) :
@layer_name = coalesce('myLayer_1','myLayer_2')
coalesce(layer_property('myLayer_1','name'),layer_property('myLayer_2','name'))

If it's not a bug, may documentation needs to be more explicit and provides a syntax example ?

How to reproduce

  • Create a project with 2 data sources
  • Create a composer
  • Add an attribute table frame
  • Switch data source to an other layer with data-defined override button

QGIS and OS versions

3.10.2-A Coruña
Windows 10 Professional

Additional context
Documentation : https://docs.qgis.org/3.10/en/docs/user_manual/print_composer/composer_items/composer_attribute_table.html#main-properties

Source issue : https://gis.stackexchange.com/questions/360482/qfield-display-attributes-table-frame-in-pdf-with-editing-offline-mode

@GeoGyro GeoGyro added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 5, 2020
@DelazJ
Copy link
Contributor

DelazJ commented May 5, 2020

Hi @GeoGyro
I did not try to replicate but as far as you are referring to the docs, I see it mentions that the layers should have the same (displayed?) columns. Do you confirm it's your case? The feature implementation PR is at #6530.

@GeoGyro
Copy link
Author

GeoGyro commented May 5, 2020

Hi,
yes it is. In my case my layers have exactly the same fields. I tried with basics "tests" layers wich only have and id(integer) field and a name(varchar) field.

@nyalldawson
Copy link
Collaborator

Your syntax looks wrong. Can you share a project which demonstrates this for me to investigate?

@nyalldawson nyalldawson added the Feedback Waiting on the submitter for answers label May 19, 2020
@GeoGyro
Copy link
Author

GeoGyro commented May 22, 2020

Hi @nyalldawson,

Here is a demo project with 2 layers and a composer :
demo.zip

I have tried differents expressions in data-defined override-button but maybe my syntax is wrong.

In my real case, I want to switch layers's names in a QField project, because QFieldSync rename layers with a (offline) suffix.

@gioman gioman removed the Feedback Waiting on the submitter for answers label May 22, 2020
@gioman gioman added the Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks
Projects
None yet
Development

No branches or pull requests

4 participants