Display results of a query field from one record above the form

My table query is based on data that is refreshed periodically. It also comes from various sources and loaded into separate tables. These separate tables are then combined, according to a series of rules, into one table that supports the table query. I have a table that keeps track of the various tables and the date of the last refresh. I prepared a sql that combines the latest version information into one field of one record. As I concatenated the fields, I placed a line feed after each table. I'd like to display this information above the form table. Any thoughts how I can tie a text field to the query record field? The list below is an example of what might be in the single field of one record from a query:

ver. 1, table 1, 1/1/2023
ver. 1, table 2, 1/5/2023
ver. 1, table 3, 1/6/2023
ver. 1 , report , 1/15/2023

Hey @adrooney!

Would you mind sharing the structure of your query's data as it appears in the State tab of your debug console (bottom right corner)?

It might also help to get a screenshot of where exactly you'd like to see the data. My suspicion, based on what you described, is that you'll want something like {{ YOUR_QUERY.data.YOUR_COLUMN[0] }} in the value field of your text component:

But I could also be totally off base here :sweat_smile:

I prepared the query in the postgresql database. I haven't brought it in to Repost yet because I wasn't sure how to place the results of a query into one text field. The query I prepared outputs one column, one row and it looks like this:

image.png

Notice I added a line feed at the end of each table name.

You should be able to format the data in Retool before putting it into a text field as well!

There are a number of ways to go about the issue. If you're happy formatting it in your database then that's fine, and you can probably use the example I posted above. But, if you're just getting started with Retool, I would recommend starting by connecting your resource using one of these docs. Then, if you can share a screenshot of what your data looks like after you've pulled it from your DB we can help from there.

Sorry for the delay in responding. I'm not seeing exactly what you are asking for. I see something on the left side called "state." It is not on the bottom right. The query name is SourceInformation. Here are the screen shots I think you might want.

image.png

In case this is not what you are referring to, I'm providing the following full screen shot so you can direct me to the appropriate place.

Lastly, I'm providing a screenshot where I might place the field.

I think that might work!

Can you try entering {{ SourceInformation.data.string_agg[0] }} into the "Value" field of your text component?

Side note - you should be able to see the structure of the data in a similar view to the screenshot I posted by expanding the data property of the query in the left panel as well:

Perfect! Thank you very much! I'm trying to learn Retool and this shows me some of the versatility of the Retool software. I knew the queries could be used to support the form, but I didn't know that you can load the result into a text field. Thanks again.

1 Like