[Qgis-user] Problem using Model Inputs variable in an Select by expression in the model Designer
Nicolas Cadieux
njacadieux.gitlab at gmail.com
Tue Jul 20 01:27:03 PDT 2021
Hi,
Does anyone have an idea?
Nicolas Cadieux
https://gitlab.com/njacadieux
> Le 8 juill. 2021 à 01:17, Nicolas Cadieux <njacadieux.gitlab at gmail.com> a écrit :
>
>
> Hi,
>
> I am creating a model that fixes Network files before they are used in the QGIS Network analysis (Shortest path) tools.
>
> This is my work flow:
>
> Create a "Length" field (value) and calculate $length in the field calculator
> Split the Multipart lines into Singlepart lines
> Create a "Length2" field (value) and calculate $length in the field calculator
> Select by expression Length != Length2. This basically gives me a selection of line that have been modified by the Multipart to Singlepart algorithm. (I get 8 results)
> This works well
>
> The problem is when I create and Input String to let the user create a "Length" field. This become a variable called @NamelengthField. My work flow become:
>
> User input "Length" in the Model input. (@NamelengthField)
> Create a "Length" field using @NamelengthField (as pre-calculated value) and calculate $length in the field calculator: This is OK
> Split the Multipart lines into Singlepart lines: This is OK
> Create a "Length2" field using @NamelengthField ||'2' (as pre-calculated value) and calculate $length in the field calculator: This is OK this field (Length2) is created and calculated properly.
> I get stuck when I try Select by expression using @NamelengthField != @NamelengthField || '2' (as pre-calculated value) (I get all lines back) and the test does not work.
> I tried stuff like
>
> @NamelengthField != (@NamelengthField || '2')
>
> '@NamelengthField != @NamelengthField || '2''
>
> "@NamelengthField != @NamelengthField || '2'"
>
> "@NamelengthField"|| !=|| "@NamelengthField || '2'"
>
> Even simple @NamelengthField = 5.286365157529550 (which should extract exactly one value).
>
> Any ideas?
>
> Nicolas
>
> QGIS 3.18.2 on Windows 10
>
>
>
>
>
>
>
> --
> Nicolas Cadieux
> https://gitlab.com/njacadieux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210720/cec06eeb/attachment.html>
More information about the Qgis-user
mailing list