Move display_expression help to variants style

This commit is contained in:
Harrissou Sant-anna 2020-07-13 22:31:31 +02:00 committed by GitHub
parent 9cf31e96ee
commit 133f8ad0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,39 +2,36 @@
"name": "display_expression", "name": "display_expression",
"type": "function", "type": "function",
"groups": ["Record and Attributes"], "groups": ["Record and Attributes"],
"description": "Returns the display expression for a given feature in a layer. If called with no parameters, it evaluates the current feature. The expression is evaluated by default.", "description": "Returns the display expression for a given feature in a layer. The expression is evaluated by default. Can be used with zero, one or more arguments, see below for details.",
"arguments": [ "variants": [
{ {
"arg": "layer", "variant": "No parameters",
"optional": true, "variant_description": "If called with no parameters, the function will evaluate the display expression of the current feature in the current layer.",
"default": "current layer", "arguments": [],
"description": "The layer (or its id or name)." "examples": [ { "expression": "display_expression()", "returns" : "The display expression of the current feature in the current layer." } ]
}, },
{ {
"arg": "feature", "variant": "One 'feature' parameter",
"optional": true, "variant_description": "If called with a 'feature' parameter only, the function will evaluate the specified feature from the current layer.",
"default": "current feature", "arguments": [ { "arg": "feature", "description": "The feature which should be evaluated." } ],
"description": "The feature which should be evaluated." "examples": [ { "expression": "display_expression(@atlas_feature)", "returns": "The display expression of the current atlas feature." } ]
}, },
{ {
"arg": "evaluate", "variant" : "Layer and feature parameters",
"description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval' function).", "variant_description": "If the function is called with both a layer and a feature, it will evaluate the specified feature from the specified layer.",
"optional": true, "arguments": [
"default": "true" { "arg": "layer", "description": "The layer (or its ID or name)" },
} { "arg": "feature", "description": "The feature which should be evaluated." },
], { "arg": "evaluate", "description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval' function).", "optional": true, "default": "true" }
"examples": [ ],
{ "examples": [
"expression": "display_expression()", { "expression": "display_expression( 'streets', get_feature_by_id('streets', 1))",
"returns": "The display expression of the current feature." "returns": "The display expression of the feature with the ID 1 on the layer 'streets'."
}, },
{ { "expression": "display_expression('a_layer_id', $currentfeature, 'False')",
"expression": "display_expression('streets', get_feature_by_id('streets', 1))", "returns": "The display expression of the given feature not evaluated."
"returns": "The display expression of the feature with the ID 1 on the layer 'streets'." }
}, ]
{
"expression": "display_expression('a_layer_id', $currentfeature, 'False')",
"returns": "The display expression of the given feature not evaluated."
} }
] ]
} }