Using a property as a table name in SQL query?

I’m using trying to use the following query as the data binding for a table. It works great until I try to use a custom property (which is a string) as the table name. Does anyone know what the correct syntax is to do this? Tried searching but no luck. Thanks!

SELECT T_Stamp, BatchID
FROM ‘{Root Container.MySQL_Table}’
ORDER BY t_stamp DESC

Try:

SELECT T_Stamp, BatchID
FROM {Root Container.MySQL_Table}
ORDER BY t_stamp DESC

Tip: using the ‘paperclip’ icon (insert property value), top right of data binding popup, will create it with the correct syntax

Thanks Matrix,

I did use the paperclip and it generated the syntax without the quotes. That didn’t work, so the quotes were a guess on my part. Double quotes didn’t work either. Any ideas?

I’m a bit unsure what you’re actually trying to achieve here.

Grab a label, place it on the same window, and bind the text property to {Root Container.MySQL_Table}

Make sure what is displayed on the label equals what you have “when it was working, before you made it dynamic”

I seem to recall that you can’t dynamically use a table name, let me check that

No issues here, it was the column name that can be tricky dynamically (best to use named queries for that)

Welp, I removed the quotes and now it’s working… even though it wasn’t before? I must have changed something between then and now. Thanks for verifying that the drag-and drop worked for you- that made me try removing the quotes again! :+1:

1 Like