Parameter field has single Quote in String - Error

Hi, I am creating a parameter field that is predicated on another parameter field that calls a text string that has a single Quote in the title. This is creating an error for me.

SELECT SKU FROM skutable
and type = {{category}}
 

The "category" parameter has titles that have single Quotes in them so I get n error when trying to pull in this Query. I have tried Single and Double Quotes in and outside of the Curly braces and still get an error.

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • If I'm understanding the situation correctly, the query that is pulling in the titles would just need to have the titles formatted such that when they're used as part of your second query the single quotes are properly escaped. something like:

    SELECT id, REPLACE(name,'''','''''') AS name
    FROM table_name
    
    {% form %}
    
    category:
      type: select
      default: ''
      options:
        labels: name
        values: name
    
    {% endform %}

    The above hypothetically pulls in "names" which end up looking like "sample'title" for example, and then turns them into "sample''title".

     

    When using that category in some other function it should then work:

    SELECT *
    FROM table_name
    WHERE name LIKE '{{ category }}'
    Like
Like Follow
  • 1 mth agoLast active
  • 1Replies
  • 14Views
  • 2 Following