It seems like you're trying to use the result of a JS Object function in an SQL WHERE IN clause. Based on the information provided, you can try the following approach:
- Create a JS Object with a function that returns the desired values as a string. For example:
{
myfunc: () => {
return "'617283','617296'";
}
}
- In your SQL query, use the
{{ }} notation to call the JS Object function:
SELECT * FROM your_table WHERE column_name IN ({{ JSObj.myfunc() }});
However, if this approach doesn't work, it might be due to limitations in the way Appsmith handles the interpolation of JS Object functions in SQL queries. In that case, you can try an alternative approach by using the params argument to pass the values into your query. Here's an example:
- Modify your SQL query to use
{{ this.params.values }}:
SELECT * FROM your_table WHERE column_name IN ({{ this.params.values }});
- Call the query using the
run() function and pass the values as a parameter:
YourQueryName.run({ values: JSObj.myfunc() });
Remember to replace YourQueryName with the actual name of your query.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: