General questions that I have not been able to find

How can I use a select that retrieves the values(title) of specific columns and when someone selects one of those the value entered on a text input is updated?.

For example Gsheets Table:

+------+--------+--------+--------+
| name | value1 | value2 | value3 |
+------+--------+--------+--------+
| Pepe | A      | B      | C      |
| Paco | D      | F      | G      |
| Luis | H      | I      | J      |
+------+--------+--------+--------+

Table 1 displays the data and the select will show columns value1, value2 and value3 so when someone selects a Row(Luis) and in the select they get value3 then the input will save the new value to replace J.

Is that possible?

Thanks in advance!

Hey Jorge!

Certainly can be done. I'll give you one way it can be done.

First you will read data from the specific sheet and display it within the table.
Afterwards you need to select a cell you want to update and based on selection you can update the original value. To further add you can build in validation or use native option in table of editing data.

With a button you can call the query which will update the spreadsheet and on success reload the data within the table so you can preview the changes.

If you need more help I'm more then welcome to assist!

Thank you for your help, this definitely helps, but I was actually wondering this:

I have a select list that displays the name of the columns (value1, value2, and value3), so if someone on that select list select value3 and based on the first example, this person has a selected row for Luis, then J will be updated, being J an input that will check the select column and selected row to add the new value.

Here's a screenshot

I can't find the part on how to generate the values of the select list from the column names (specific columns, which should be a different query as they don't show in the original table) and how to make the input save the data based on the selected row and match it with the selected column (based on the example would be Luis/value3 (so J on the sample table).

I hope I made this more clear and thank you for your help.

So instead of selecting a cell, in this case you would just update the example query to reference the select dropdown with your column names. End result would be you are updating sheet where your unique key ('name') is filter for the row and value you are updating is based on the select dropdown.

1 Like

I greatly appreciate your help, Stefan, and apologies for the delay.

I am not sure what am I doing wrong or what I am missing, but here's a screenshot of what I am getting:

And the query

And the item table1 is the one that shows all the elements in the sheet, the query is listMoversEmployees but to get the column names, I am using a different query called rateColumns, this query is throwing an empty response, and I am using the values you mentioned.

Thanks!

So if selectRatesPeriod has your column names (value1,value2,value3) then {{table1.selectedCell.columnName}} has to be replaced with {{selectRatesPeriod.value}}. And where you have {{selectedRatesPeriod.value}} you need to replace it with actual value which you are sending.

What we are trying to accomplish is "Update value" being an object with key value in your case {value3:79.90}. Hope that clarifies it.

Hi @stefancvrkotic I apologize for being a pain :see_no_evil: Definitely not what I wanted when I checked here.

I think that I still am not getting it, but let me back a bit.

I have a Select List element called selectRatesPeriod that I want to dynamically get the column names (Reason being, there are more than 20 columns and potentially will add more).

I have created a form that displays the data from a selected row, so what I would like to do is that when someone selects a row they have the possibility to select any of the columns (value1, value2, value3) and update(populate if it's empty) the value of a cell from the selected row.

With what you mentioned for the query rateColumns, I am trying to get the column names, but I am getting a null response when I run the query.

I think it's worth mentioning it, but the table1 element is getting the data from the query listMoversEmployees.

Thanks again!

There are two methods that you can choose:

  1. As you mentioned build a form from a selected row and then push values if they changed.

  2. If you do not know how many columns there will be and you want this to be dynamic, then you will have to load all column keys within a select (or multiselect) - using {{table.columns}} array. Then based on selection build a transformer that will pass one or multiple values to the update query.

Not sure I understand what specific area of this is proving difficult to solve as I'm not aware of the full environment.

1 Like

The issue I am having is that I have not found the docs where it outlines for example the {{table.columns}} or transformers (I found it in the transformers section, so I am one step ahead), just to add more details to this, I am on the trial period doing a test, it definitely looks like it will work for us, but I have not been able to move forward with this, the select is basically, so I don't have to add 20 inputs in the same form when people will see the most current (The most current is the last element of the columns, I am doing this through a formula on Google Sheets so in the form I show one input, for example, I add one more record on value1, then the current column will show value1 "value", if I then add something on value3, then the current column will show value3), but when someone updates it, they need to do it on a specific column.

I hope this makes sense.

Thanks again.

If I understood you correctly you might want something like this.


Once you load data you need to populate the select with column names.

Input value can be populated with default value by combining selected row and selected column.

Once you change the value you can push it back to the sheet with a query.

image

Considering you are using trial version and what you are trying to accomplish sounds reasonable, might be worth reaching out to retool support so they can guide you through your environment and make sure you are satisfied with the product. Speaking from experience a lot of things can be done in Retool with ease it just comes down to best practices and your business needs.

Thank you, from what I see, your solution should help me, the problem is that I have not been able to retrieve the column names as I get the following error:

But if I add it like this (suggested by ReTool support)

{{Object.keys(listMoversEmployees.data[0])}}

Then it shows all the column names, but I can't define which specific columns to show there.

Any suggestions?

Thanks in advance!

Hi @jorgediaz!

Happy to help with this! Would you mind sharing the output of {{Object.keys(listMoversEmployees.data[0])}} and an example of what you'd like to see in the component?