Using JS to Continue Query

Hello guys,

Assuming I have these 2 fields:

I want to make a JS query to resolve the query depending on those dropdown menu.

For example:

let query = SELECT * FROM table1 WHERE 1=1

if (select_campana.value != null) {
   let q2 = query + "AND campana = select_campana.value"
} else if (select_conexion != null) {
   let q3 = query + "AND conexion = select_conexion.value"

// run the query here

How to achieve this thing and then run the query after?

Hi @yeftanma

Thanks for reaching out!

Will you be running the query as a SQL query? If so, you should be able to use JS inside your SQL query to make it dynamic based on the component values.

Here's an example :

We also have some examples in our docs: