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

Add new variable form of current feature expression functions #50134

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

nyalldawson
Copy link
Collaborator

@nyalldawson nyalldawson commented Sep 8, 2022

This adds a newer style variable form of referencing the current feature and its attributes in expressions.

The newly introduced variables are:

  • @feature: a replacement for $currentfeature, contains the current feature
  • @id: a replacement for $id, contains the current feature id
  • @geometry: a replacement for $geometry, contains the current feature geometry

This is intended as a step towards eventually deprecating the older $ style functions, and providing a more consistent approach to expressions instead of the older unpredictable mix of @/$. For now these old functions still work (and likely will ALWAYS remain working for old project compatibility), AND they are also still exposed in the UI just to avoid user confusion (eventually we can hide them).

@nyalldawson nyalldawson added Expressions Related to the QGIS expression engine or specific expression functions Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Sep 8, 2022
@github-actions github-actions bot added the GUI/UX Related to QGIS application GUI or User Experience label Sep 8, 2022
@github-actions github-actions bot added this to the 3.28.0 milestone Sep 8, 2022
@DelazJ
Copy link
Contributor

DelazJ commented Sep 8, 2022

How about adding a note in the functions help that they can be replaced by the variables? The variables will then be more exposed to users and people won't be confused by seeing "duplicate" items.

@DelazJ DelazJ added the Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. label Sep 8, 2022
@github-actions
Copy link

github-actions bot commented Sep 8, 2022

@nyalldawson
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@nyalldawson
Copy link
Collaborator Author

@DelazJ

How about adding a note in the functions help that they can be replaced by the variables? The variables will then be more exposed to users and people won't be confused by seeing "duplicate" items.

Good idea, done

This adds a newer style variable form of referencing the current
feature and its attributes in expressions.

The newly introduced variables are:

- @feature: a replacement for $currentfeature, contains the
current feature
- @id: a replacement for $id, contains the current feature id
- @geometry: a replacement for $geometry, contains the current
feature geometry

This is intended as a step towards eventually deprecating the
older $ style functions, and providing a more consistent
approach to expressions instead of the older unpredictable mix of @/$.
For now these old functions still work (and likely will ALWAYS
remain working for old project compatibility), AND they are also
still exposed in the UI just to avoid user confusion (eventually
we can hide them).
@nyalldawson
Copy link
Collaborator Author

I've had to go with just "@feature" here instead -- unfortunately "@current_feature" has already been used elsewhere (in forms)

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

@nyalldawson
A documentation ticket has been opened at qgis/QGIS-Documentation#7773
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Oct 16, 2022
@agiudiceandrea
Copy link
Contributor

Hi @nyalldawson, It seems there is an issue with the new @geometry variable: #50791.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Expressions Related to the QGIS expression engine or specific expression functions GUI/UX Related to QGIS application GUI or User Experience Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants