Grab Value of Custom Column AFTER It's Been Edited?

Hi all, I'm stumped on how to grab a value of a custom column after it's been edited.

For some context I'm creating a tool that updates a Mongo database where users can input values in a custom column and update the record on the click of a button in another custom column in the same table.

However I can't seem to grab the value of the desired_value column. For context the value is {{ self.value }}.

Using:
const ind = table1.selectedRow.index
const desiredMargin = table1.columnMappers['Custom Column 3'][ind];

I get nothing returned, even after I've edited a column. Can someone please help I've been stuck on this for several hours. T__T

Much appreciated,
Sarah

Hey sarah,

If you use new table component you should be able to assign a key to a custom column and reference it from changesetArray.

Example:


image

2 Likes

Hey Stefan,

Thank you so much for the quick reply! I'm having trouble navigating to that view in your screenshot - how did you get to that table1 > Desired Value view in the right panel?

W gratitude,
Sarah

Hey Sarah,

This only applies for new table component. Once you click on the column it will open the view in the right panel.


image

1 Like

Ah, to clarify - is new table component different from adding a custom column? How can we add a new table component if so?

This is what currently pops up when I select the column name:

Yes, new table is different then adding a custom column.


If you are on the old table you can use {{table.recordUpdates}} however you need to be accessing the column via Custom Column 1,2,3 etc which in the long term isn't optimal (and be mindful of the type of data as it's apparently saved as string)

image

I'm not sure if I have an outdated version of Retool however I cannot access the new table view - my table view looks completely different, so perhaps I'll have to try to use recordUpdates. Thank you so much for your help, you're the best!

Glad I could help!

Hi @sarah!

The new Table component should be available to all cloud users. Is your deployment self-hosted?

If you are on cloud, do you mind checking the version that's displayed in the lower-right?

Hi Alexi, the version is Retool version 2.97.5. I am on a staging site, so perhaps its on an older version.

I have another related question - is there a way to have a Javascript query trigger a Resource query, where a variable in the JS query can be used in the Resource query?

Certainly doable but approach might be different depending on the use case. I'll give 2 different examples (but I'm sure there are other ways):

  1. When running JS query use a temporary state to store the variable you want to pass.

  2. Different approach would be to make your JS return an object of the data (results) and values you want to pass.

You can then trigger the resource query on success or after the value has been set but it will depend on what you need to accomplish!

3 Likes

Beautiful! Thank you so very much Stefan, you've been a great help + I hope you have a wonderful Friday. :slight_smile:

3 Likes