How can I use a lookup value in an action

How can I use a lookup value in an action. At the moment the column I need is not available in the list of columns when trying to set values of a table. I guess I need to create a new column that is derived from the lookup column somehow. But not having luck with anything I try. I am trying to use the ‘temp/PIN’ column:

Change the relation to a single relation so that the lookup column changes from an array to a single value.

1 Like

I am using SV. What is happening is that a new row(in employee table) is being created that automatically creates a random PIN. I need to be able to retrieve that PIN to then store into the users table.
So not sure how I can change the relation to a single relation and be able to retrieve the last row.

So the lookup column is retrieving the single value Last Pin directly from the temp table without using a relation? Why not replace the lookup column with a single value column that does the same thing as your existing single value column?

1 Like

Thanks that works… after I resolved a bug with adding a new row from the actions… is it a known bug that you have to have at least one column with a value you can set for adding a new row? It was a simple fix of adding a dummy column that I just set with “temp” text.

Are you saying that you were trying to add a completely empty row?

No. I have a row that has some generated columns… a row can be added fine from the data directly - but in the action - you need to have at least one column that requires manual input.

My table is a bunch of lookups, calculations etc. There is one column which is rand - which means there is at a minimum a value in that column when the row is added.

It was an easy fix of simply adding a column where I simply add a static value from within the action. But of course it introduces an extra column - and makes it susceptible to being accidently deleted and causing issues… as a traditional coder - I like “clean” code. :slight_smile:

Yeah, that might be your only option. Typically when adding a row, you’re adding something, so I suppose Glide prevents adding if you aren’t adding setting any column values in that add function.

Yeah… not a biggie… I will just come up with a naming convention to ensure that I know not to ever delete it :slight_smile:

“DO NOT DELETE” is a pretty effective column name. :wink:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.