Query all records from ANY table using the Direct Database Query

One of my pet peeves with Xano is I have to always create a new Query All Records in just about every function stack.

I would like to create a reusable function where I can specify the table name of the table that I wish to query and then use the Direct Database Query to perform the action given the input of $tableName. However I can't figure out how to map the user friendly names to the internal x referenced tables within my Xano instance.

My friendly table names mapped with the x table names


Here is my function stack:


I just don't know how to map the user friendly names to the input of $tableName so that I can have the x2_24 (cities) be looked up from the input of $tableName and then inserted into the SQL as a variable


The Direct Database Query is working when I hardcode the x referenced tablename, I just need that to be dynamic based on the input .



Can anyone provide insights?

Thanks,

Mike

1 reply