2016-10-27 14:45:13 +02:00
{
"name": "is_selected",
"type": "function",
2020-07-02 01:46:48 +01:00
"groups": ["Record and Attributes"],
2022-03-21 09:20:52 +01:00
"description": "Returns TRUE if a feature is selected. Can be used with zero, one or two arguments, see below for details.",
2022-01-07 08:33:29 -05:00
"variants": [{
"variant": "No parameters",
2022-03-21 09:20:52 +01:00
"variant_description": "If called with no parameters, the function will return TRUE if the current feature in the current layer is selected.",
2022-01-07 08:33:29 -05:00
"arguments": [],
"examples": [{
"expression": "is_selected()",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the current feature in the current layer is selected."
2022-01-07 08:33:29 -05:00
}]
}, {
"variant": "One 'feature' parameter",
2022-03-21 09:20:52 +01:00
"variant_description": "If called with a 'feature' parameter only, the function returns TRUE if the specified feature from the current layer is selected.",
2022-01-07 08:33:29 -05:00
"arguments": [{
"arg": "feature",
"description": "The feature which should be checked for selection."
}],
"examples": [{
"expression": "is_selected(@atlas_feature)",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the current atlas feature is selected."
2022-01-07 08:33:29 -05:00
}, {
2023-04-07 15:52:32 +02:00
"expression": "is_selected(get_feature('streets', 'name', 'Main St.'))",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the unique named \"Main St.\" feature on the active \"streets\" layer is selected."
2022-01-07 08:33:29 -05:00
}, {
"expression": "is_selected(get_feature_by_id('streets', 1))",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the feature with the id 1 on the active \"streets\" layer is selected."
2022-01-07 08:33:29 -05:00
}]
}, {
"variant": "Two parameters",
2022-03-21 09:20:52 +01:00
"variant_description": "If the function is called with both a layer and a feature, it will return TRUE if the specified feature from the specified layer is selected.",
2022-01-07 08:33:29 -05:00
"arguments": [{
"arg": "layer",
"description": "The layer (its ID or name) on which the selection will be checked."
}, {
"arg": "feature",
"description": "The feature which should be checked for selection."
}],
"examples": [{
"expression": "is_selected( 'streets', get_feature('streets', 'name', \"street_name\"))",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the current building's street is selected (assuming the building layer has a field named 'street_name' and the 'streets' layer has a field called 'name' with unique values)."
2022-01-07 08:33:29 -05:00
}, {
"expression": "is_selected( 'streets', get_feature_by_id('streets', 1))",
2022-03-21 09:20:52 +01:00
"returns": "TRUE if the feature with the id 1 on the \"streets\" layer is selected."
2022-01-07 08:33:29 -05:00
}]
}],
2022-01-11 11:17:49 -05:00
"tags": ["selected", "arguments", "details"]
2022-01-07 08:33:29 -05:00
}