Nicolas,
I have not looked at this in too much detail, but at a quick glance, could it 
not be the fact that you should be using the newly created fields? As in 
instead of @NamelengthField != @NamelengthField || '2', should it not be more 
like your previous example Length != Length2

Regards,

Richard



——
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964 T +353 46 942 2409
https://gov.ie/opw

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/[email protected]

Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/
From: Qgis-user <[email protected]> On Behalf Of Nicolas Cadieux
Sent: 20 July 2021 09:27
To: Qgis Users List <[email protected]>
Subject: Re: [Qgis-user] Problem using Model Inputs variable in an Select by 
expression in the model Designer

Hi,
Does anyone have an idea?
Nicolas Cadieux
https://gitlab.com/njacadieux


Le 8 juill. 2021 à 01:17, Nicolas Cadieux 
<[email protected]<mailto:[email protected]>> 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:

  1.  Create a "Length" field (value) and calculate $length in the field 
calculator
  2.  Split the Multipart lines into Singlepart lines
  3.  Create a "Length2" field (value) and calculate $length in the field 
calculator
  4.  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:

  1.  User input "Length" in the Model input. (@NamelengthField)
  2.  Create a "Length" field using  @NamelengthField (as pre-calculated value) 
and calculate $length in the field calculator: This is OK
  3.  Split the Multipart lines into Singlepart lines: This is OK
  4.  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.
  5.  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
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to