<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi,<div>Does anyone have an idea?<br><br><div dir="ltr">Nicolas Cadieux<div><a href="https://gitlab.com/njacadieux">https://gitlab.com/njacadieux</a></div></div><div dir="ltr"><br><blockquote type="cite">Le 8 juill. 2021 à 01:17, Nicolas Cadieux <njacadieux.gitlab@gmail.com> a écrit :<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Hi,</p>
<p>I am creating a model that fixes Network files before they are
used in the QGIS Network analysis (Shortest path) tools.<br>
</p>
<p>This is my work flow:</p>
<ol>
<li>Create a "Length" field (value) and calculate $length in the
field calculator</li>
<li>Split the Multipart lines into Singlepart lines</li>
<li>Create a "Length<b>2</b>" field (value) and calculate $length
in the field calculator</li>
<li>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)<br>
</li>
</ol>
<p>This works well</p>
<p>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:</p>
<ol>
<li>User input "Length" in the Model input. (@NamelengthField)</li>
<li>Create a "Length" field using @NamelengthField (as
pre-calculated value) and calculate $length in the field
calculator: This is OK<br>
</li>
<li>Split the Multipart lines into Singlepart lines: This is OK</li>
<li>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. <br>
</li>
<li>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.<br>
</li>
</ol>
<p>I tried stuff like<br>
</p>
<p> @NamelengthField != (@NamelengthField || '2')</p>
<p>'@NamelengthField != @NamelengthField || '2''</p>
<p>"@NamelengthField != @NamelengthField || '2'"</p>
<p>"@NamelengthField"|| !=|| "@NamelengthField || '2'"</p>
<p>Even simple @NamelengthField = 5.286365157529550 (which should
extract exactly one value). <br>
</p>
<p>Any ideas?</p>
<p>Nicolas<br>
</p>
<p>QGIS 3.18.2 on Windows 10 <br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Nicolas Cadieux
<a class="moz-txt-link-freetext" href="https://gitlab.com/njacadieux">https://gitlab.com/njacadieux</a></pre>
</div></blockquote></div></body></html>