Closed abgonzalez93 closed 3 weeks ago
You can concatenate strings before adding it to the query, like this:
desc_agencia LIKE {'%' + param('agency_filter') + '%'}
or interpolate it if you need it:
desc_agencia LIKE \'{interpolate('%' + param('agency_filter') + '%')}\'
Also, you can use variables for improving the query readability:
{#if param('agency_filter', false)}
{filter = '%' + param('agency_filter') + '%'}
AND desc_agencia LIKE \'{interpolate(filter)}\'
{/if}
Yeah, that actually helped. Thanks for your time! It might be interesting if it's put into the website
You're right! I'm working on improving the SQL logic documentation to make it more clear and easy to understand. Thanks for the feedback!
Environment
node -v
): 18.20.2npm -v
): 10.5.2latitude --version
): 0.8.2latitude.json
at the root of your project): 0.11.0Actual Behaviour
Is there anyway to concat a String with a param variable inside a SQL code? For example, in my case, Im using a LIKE operator, which uses a % inside a string, ie '%something%' So my question is, how can you concat a string with a param(variable) or even {interpolate(param(variable))}
This is my code right now (but its not working tho)