4

I have an expression get_feature('Schools', 'INST_NO', "schoolid") which returns a feature, as intended:

enter image description here

However, I want to test if the feature is currently selected. So, I have created this expression is_selected(get_feature('Schools', 'INST_NO', "schoolid"), 'Schools') Which looks just like the example given in the help text for is_selected. However, this does not work; it throws the error Eval Error: Cannot convert to feature:

enter image description here

TimD
  • 429
  • 3
  • 10
  • Please open issues in the QGIS repository: https://github.com/qgis/QGIS/issues – pigreco Jun 04 '20 at 15:09
  • 1
    I didn't know it was a documentation issue, but now that this has been confirmed by the accepted answer, I have created a GitHub issue at https://github.com/qgis/QGIS/issues/36983 – TimD Jun 04 '20 at 23:13

1 Answers1

5

Seems to be an error in the documentation. The syntax must be: is_selected([layer=current layer][, feature=current feature]).

Try: is_selected('Schools', get_feature('Schools', 'INST_NO', "schoolid"))


Source: https://github.com/qgis/QGIS-Documentation/issues/1475

Gabriel De Luca
  • 14,289
  • 3
  • 20
  • 51
  • 1
    Thank you, your suggestion works. I have submitted a GitHub issue to have the documentation updated at https://github.com/qgis/QGIS/issues/36983 – TimD Jun 04 '20 at 23:24