Bot fails to write correct Key value when running "add a new row" action

Hello,

I have a Bot that is triggered by an update on my Teams table. The bot needs to create new rows in my Pass table.

One of the steps in my Bot runs an “action on a set of rows” (Run an action on rows).

  • Referenced Table: Säsongsplan

  • Referenced Rows: FILTER("Säsongsplan", [TeamID] = [_THISROW].[TeamID])

  • Referenced Action: An action called Lägg till ETT Simulerat Pass.

The action Lägg till ETT Simulerat Pass is for the table Säsongsplan and uses add a new row to another table.

  • Table to add to: Pass

  • In Set these columns, I try to set the value for Pass[VeckaID] (which is a Ref to the Säsongsplan table).

The Bug: When I set Pass[VeckaID] to [VeckaID], it writes the Label of the Säsongsplan row, not the Key. I have tried forcing the Key with INDEX(LIST([VeckaID]), 1) and [_THISROW].[VeckaID], but they all fail and write the Label instead.

Because the wrong value is written to Pass[VeckaID], all subsequent LOOKUP and SELECT formulas that rely on this relationship fail. The app is completely broken because of this one step.

How can I force the action, when run by the bot, to write the correct Key value?

Please post screenshots of the involved configurations.

3 Likes

Screenshots

Hope this helps, as new user I can only upload 3 pics, let me know if you need more and what?

1 Like

The expression here should definitely be just [VeckaID]:
image

Please post the expressions used for these columns:

Please post the columns list for the Pass table.

1 Like

I’ve removed the index part and changed to [VeckaID]

Hämtad_Färdighetsövn (Text)

LOOKUP([VeckaID], “Säsongsplan”, “VeckaID”, “Färdighetsövn”)

Hämtad_Spelövn (Text)

LOOKUP([VeckaID], “Säsongsplan”, “VeckaID”, “Spelövn”)

Hämtad_Fysträning (Text)

LOOKUP([VeckaID], “Säsongsplan”, “VeckaID”, “Fysträning”)

(theres in one more DEBUG row at the bottom,

DEBUG_LOOKUP_RESULTAT: “LOOKUP([VeckaID], “Säsongsplan”, “VeckaID”, “Färdighetsövn”)”

Before we go any further, first fix all of those LOOKUP() expressions.

1 Like

Please guide me in what is the issue with the LOOKUP() expressions, should I change them to SELECT() or is there anything else wrong with the expressions?

I’ve provided exact direction with the link. If that isn’t sufficient, I can’t help you.

1 Like

I’m sorry, still very new to all this and trying my best, like this?

New value for column Hämtad_Färdighetsövn (Text)

LOOKUP([_THISROW].[VeckaID], “Säsongsplan”, “VeckaID”, “Färdighetsövn”)

New value for column Hämtad_Spelövn (Text)

LOOKUP([_THISROW].[VeckaID], “Säsongsplan”, “VeckaID”, “Spelövn”)

New value for column Hämtad_Fysträning (Text)

LOOKUP([_THISROW].[VeckaID], “Säsongsplan”, “VeckaID”, “Fysträning”)

Yes.

In the pass table there is a virtual column called DEBUG_Hämtat_Veckonummer with the formula LOOKUP([VeckaID], "Säsongsplan", "VeckaID", "Vecka").

Expected result: It should find the matching week and return the week number (e.g., 3).

Actual result: It returns 1 for all rows.

Is this LOOKUP also wrong or what more do I need to do?

The documentation I pointed you to earlier makes it clear: always use [_THISROW]. with that first column reference in LOOKUP().

1 Like