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

Select all and copy paste of attribute values erroneusly inserts Null values for excluded data rows #55781

Open
1 of 2 tasks
celmi opened this issue Jan 8, 2024 · 7 comments
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@celmi
Copy link

celmi commented Jan 8, 2024

What is the bug or the crash?

In the attribute table, when filtering data and then using select-all to copy-paste values, the excluded data shows up as "Null" values in the data export. A user however expects to have only the shown data in the export.

Steps to reproduce the issue

  1. Open attribute table (in my example: 51860 rows of data)
  2. Filter rows to a subselection of all available data (in my example: 10 rows)
  3. Select all (of the resulting rows after filter operation; in my example 10 rows)
  4. Copy
  5. Open Spreadsheet or text file
  6. Paste

What should happen: in the spreadsheet/text file there should be the same number of data-rows as displayed in the attribute table (in my case: 10 rows of data)

What happens instead: QGIS exports a null value for each excluded data-row and appends the filtered data-row at the very end. (in my case I get 51850 rows of "Null" values and at the very end 10 rows with the actual filtered data

Versions

QGIS 3.28.14

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@celmi celmi added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jan 8, 2024
vaahtokarkki added a commit to vaahtokarkki/QGIS that referenced this issue Apr 12, 2024
When selecting all features in attribute table, select only features
visible in the table instead of all features in layer. Fixes qgis#55781
@tudorbarascu
Copy link
Member

tudorbarascu commented Apr 12, 2024

Actually, the "Select all" button does what it's supposed to do and that is : Select all. You can select all the filtered features by clicking on the left/top corner of the attribute table.

Adding a button for "Select all filtered" features would be a feature request and not a bug.

@DelazJ
Copy link
Contributor

DelazJ commented Apr 14, 2024

Actually, the "Select all" button does what it's supposed to do and that is : Select all.

@tudorbarascu Not really if the pasted data are full of NULL values. The correct behavior would be to paste data as in the layer. There is a bug in the described behavior.

Anyway, it might be worth checking what is actually selected in the map canvas when you press the "Select all" button from a filtered attribute table. Then if you remove the filter within the table, are all the features selected or just the previously filtered ones? Could help clarify what the "Select all" button actually does in a filter context.

@uclaros
Copy link
Contributor

uclaros commented Apr 14, 2024

I'm mostly with Tudor on this. Select all should select all and it actually selects all.
There are however several issues:

  1. Filtered out features are copied as null values when copied through the attribute table (if they are copied using menu edit > copy features things work correctly) so the bug report is valid.
  2. Copy shortcut mentions "copy selected rows to clipboard" which is not what it actually does
  3. The select all filtered shortcut is hidden like an easter egg!

@vaahtokarkki
Copy link
Contributor

I am replying here about my PR #57140 related to this issue.

I found also #53150 issue labelled as a feature request (to be honest I didn't even realize this could be a feature request). As the issue states, the current behaviour of the "Select all" button (and ctrl+a) is counterintuitive in the context of the attribute table. To compare how other software behaves in such a situation, for example Excel: get a table full of data, filter some rows out, ctrl+a: no filtered out rows are selected and possibly copied to clipboard.

Also, the separate button for selecting all filtered features feels a bit unnecessary, as the current behaviour of selecting all features of the layer still exists when "Show all features" is active. At least the select all button should state that it always selects all features in the layer, which it currently does not state. But in this case, if the current behaviour is correct the bug in deed exist as @uclaros described.

@vaahtokarkki
Copy link
Contributor

To justify PR #57140 and issue #53150 more: currently, the selection toolbar has already a "Select All Features" action, which does exactly what it states. Therefore I see even less reason to keep the current behaviour of the select all action in the attribute table.

vaahtokarkki added a commit to vaahtokarkki/QGIS that referenced this issue Apr 15, 2024
When selecting all features in attribute table, select only features
visible in the table instead of all features in layer. Fixes qgis#55781 and qgis#53150
@uclaros
Copy link
Contributor

uclaros commented Apr 15, 2024

Comparing to a single spreadsheet is not fair, since in QGIS we also have a map that still contains the filtered out features which can also be selected using the map tools or even other attribute tables.
I can see that probably the most common and intuitive behavior is to select all filtered rows, however if we decide to switch to that behavior there are other things to consider at the same time:

  1. Is the name Select all proper any more?
  2. Is the shortcut Ctrl+A proper any more? This shortcut will have different action depending on focused widget and could be easy to miss when having docked attribute tables.
  3. Should we keep the Invert selection logic as is applying to the whole layer?
  4. Should we also modify Select using an expression?
  5. Do we also need a Deselect all filtered button?

My answer to all of the above is: I don't think so

@celmi
Copy link
Author

celmi commented Apr 15, 2024

Just a small input regarding the user interface: in some software, the user interface shows a button for a command, and just below/next to the button there's a small arrow-button indicating further variants of that command. Upon clicking the arrow, these variants are accessible. I am finding this quite an intuitive way to help users find their way. I imagine there's a select-all button with such an arrow. As a user, if this command is not doing what I'd been expecting (e.g. because excel works differently) the next attempt will be clicking the arrow and there I'd find "select all filtered features" (ideally with its own keyboard-shortcut).

But I'd still expect that not-selected attributes will not create a null-line in the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attribute Table Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants