Lava Filters - SanitizeSql

Category:Text

Description:Accepts a string as input and sanitizes it for use in a SQL statement.
Input: "CurrentPerson": { "LastName": "O'Neal" }
Lava: {% sql %} SELECT [FirstName] FROM [Person] WHERE [LastName] = '{{ CurrentPerson.LastName | SanitizeSql }}' {% endsql %}

Used sanitized string {{ CurrentPerson.LastName | SanitizeSql }} to find these names.

    {% for item in results %}
  • {{ item.FirstName }}
  • {% endfor %}
Output:

Used sanitized string O''Neal to find these names.

  • Jack