I want to make a query builder. Saw the recipe in this article https://medium.com/starschema-blog/advanced-server-side-filtering-for-tables-in-appsmith-1c8bd595559c
This is my query:
SELECT * FROM companies
where 1=1
{{ JSObject1.getCompaniesConditionSql() }}
ORDER BY {{ companies_table.sortOrder.column || 'id'}} {{ companies_table.sortOrder.order || 'ASC'}}
LIMIT {{companies_table.pageSize}}
OFFSET {{(companies_table.pageNo - 1) * companies_table.pageSize}};
This is js code:
getCompaniesConditionSql: () => {
var conditionSql=""
if (!!companies_global_status_select.selectedOptionValue){
conditionSql= conditionSql + "and global_status='" + companies_global_status_select.selectedOptionValue+"'"
}
return conditionSql
}
But when I run, there is an error. Looks like appsmith adds additional quotes and it breaks sql.
Is there a way to implement query builder?