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

Field_name in actions #29933

Closed
qgib opened this issue May 22, 2019 · 3 comments
Closed

Field_name in actions #29933

qgib opened this issue May 22, 2019 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers stale Uh oh! Seems this work is abandoned, and the PR is about to close.

Comments

@qgib
Copy link
Contributor

qgib commented May 22, 2019

Author Name: Alessandro Perego (Alessandro Perego)
Original Redmine Issue: 22120
Affected QGIS version: 3.4.8
Redmine category:actions


(tested on QGIS 3.4.8 on Windows 10)

Actions in field scope have three variables: field_index, field_name, field_value.
Field_name doesn’t work when actions run from attribute table.

For example the following python action (in field scope):

from qgis.PyQt import QtWidgets
expr = '"[% @field_name %]"' + ' = ' + "'[% @field_value %]'"
QtWidgets.QMessageBox.information(None, "[% @field_name %]", expr)

works good from Identify Result panel, but when the action run from the attribute table it doesn’t show the name of the field.

A workaround is using the field index:
layer = QgsProject.instance().mapLayer('[% @layer_id %]')
field_name = layer.fields().field([% @field_index %]).name()


@qgib qgib added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 25, 2019
@gioman
Copy link
Contributor

gioman commented Dec 14, 2021

but when the action run from the attribute table it doesn’t show the name of the field.

Seems ok to me on 3.22.1

@gioman gioman added the Feedback Waiting on the submitter for answers label Dec 14, 2021
@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Dec 29, 2021
@github-actions
Copy link

While we hate to see this happen, this issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue.
Or, if you have any further questions, there are also further support channels that can help you.

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! Feedback Waiting on the submitter for answers stale Uh oh! Seems this work is abandoned, and the PR is about to close.
Projects
None yet
Development

No branches or pull requests

2 participants