Hoppa till huvudinnehållet

Passing Text Box Value From Form to Query Layer

Kommentarer

7 kommentarer

  • chris c

    Kevin, you'll need to enclose your output value.

    =`(PIN88 = '${$form1.state.textBox1.value}')`

    I normally create a value for the where clause and set the property of that with the above statement, then call that value in the query where clause.

    Hope this helps. 

    2
  • Kevin Fowler

    Hi Chris,

    That is exactly what I was looking for! Could you direct me to or explain what the additional characters do? I've been searching VertiGIS for days and haven't been able to find anything on this.

    Thank you!

    0
  • Nico Burgerhart

    This is an expression in the form of a Template Literal, see

    https://docs.vertigisstudio.com/workflow/latest/help/Default.htm#wf5/help/expressions.htm#use-string-expressions

    • Template Literal: Template literals provide a compact alternative to concatenating strings using multiple plus signs. They allow you to embed activity outputs within string literals using this notation: ${activity_output}. For example, to embed $prompt1.result in a literal string, you would use ${$prompt1.result}. Template literals are enclosed between grave accents ( ` ), also known as backticks.

      To configure the Confirm activity's Text input using a template literal:

      =`You entered ${$prompt1.result}. Is this correct?`

      For more information, see Template Literals.

    3
  • Kevin Fowler

    Nico,

    Perfect thank you! I suppose the real problem is that I don't know what to search for in the help document.

    This makes much more sense now.

    Thanks!

    0
  • Zack Robison

    The operative parts here Kevin are the tickmarks, braces, and extra dollar.  These are the syntax for what JS (and TS) call template literals.  This is the way I recommend building strings because it tends to be far more readable than a bunch of quotes and pluses.  You might review the documentation on expression syntax in Workflow to get your feet wet there.

    Also, I don't see the single quotes in your original expression.  Perhaps you just missed them in your post, or you were trying to give some pseudocode, but it looks like the query syntax required them and you might have missed them.  The parentheses are superfluous in your case so far, but can be a helpful habit if you start making bigger queries with longer where clauses.

    0
  • Kevin Fowler

    Thank you everyone! I was able to do exactly what I wanted.

    Now how would I go about querying a layer based on user input from a geometry picker result? I've tried removing my where clause in the query layer activity and instead using the below expression in the Geometry section but I get an error.

    =$form1.state.geometryPicker1.value.geometry

    0
  • chris c

    Kevin, you will need to get the map click from the map by using Cast Geometry and entering: =$displayForm.state.geomPicker.value.geometry[0]  - This will grab the map click. I then project the geom output of the cast into the map projection of the webmap. You can then use the output of the Project Geometry in the geometry argument in the query function like this: =$projGeom.geometry

    0

Du måste logga in om du vill lämna en kommentar.