Trigger Query from SelectedQuery Variable Name

Is it possible to trigger a query based on a variable value?

// Get the value of the selectedQuery variable
const queryName = SelectedQuery.value;

// Trigger the query based on the value of the selectedQuery variable

The code above does not work.

I have queries that are merged into an array and displayed in a table. I have a column that has a button which when clicked sets the value of SelectedQuery to the corresponding query for that row. I want to be able to click that button and trigger only that query to run.

Thanks for any help!