Matching lookups after the row is created

Hi all

I have a strange scenario here but actually have seen this issue in other places before. I create a row in a table when a particular event occurs and one of the fields I populate is a lookup to another table. The automation happily populates a value into this column even if the other table does not have that as a valid value. My import process does eventually create that value on the other table but the lookup still shows as unmatched and never “refreshes” if you see what I mean so that I end up with a permanent unmatched value.

My question is: how do I either prevent this unmatched row from being created OR how do I get the lookup to refresh once it has a valid matched value so that the doc can carry on doing its thing?

Hope this makes sense. It’s a bit obscure but a fairly common problem I’ve seen with lookups.

Hi @Jarred_Cinman :blush: !

Maybe IsFromTable() could help you here :blush:

IsFromTable() checks if a row reference comes from a table or not.
So, depending on what you mean by “refreshes”, you could for example have a button (or an automation… or even both) to remove the rows from your table, after import, if the values in the lookup field don’t have a matching value in the table storing the values of the lookup field :blush: .

In the sample you’ll se below, I have a canvas button which when pushed remove the rows from the table Table if the values in the lookup field are Not() from the table Lookup
(see the greyed out row references in the lookup field in the table Table)

The Action formula in my button is :

Table.Filter(Lookup.IsFromTable(Lookup).Not()).DeleteRows()

And what it does is it takes my table Table and checks if the CurrentValue.Lookup (i.e.: each row reference in the lookup field) is effectively from the table Lookup.

If true, the row is kept by the filter and ignored otherwise :blush: .
So far, the list of rows Filter() returns is the list where the values in my lookup field matches the values in the table Lookup.

But as I want to delete rows where the values in the lookup field doesn’t match the values in the table Lookup, I negate the condition within the Filter() using Not() which now gives me the appropriate list of rows I can finally delete :blush: .

I hope this helps a little :innocent: !

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