Forum Discussion

ShaneMiller's avatar
ShaneMiller
Qrew Member
2 years ago

Pipelines | Multi-Select Text | Duplicates

Hello,
My scenario has to do with baseball and creating rosters based on a persons preferred positions.

Here is my scenario:

Step A: Search Table 'Players' (Players table pulls in Text Field with the [Name] and a multi-select text with the persons [Preferred positions])
Query- no filters
Step B: Search Table 'Game' (Game table pulls in Multi-Select [Attendance] with the Players that will be at that game, and multi-select fields for each position [catcher][pitcher][1st base], etc)
Query- [B.Attendance] contains [A.name]

(this only pulls people in that specific game)

For Each B, if the Table A [A.Preferred_Positions] contains Catcher 
Then
Update Record B Games table:
B.Catcher Field jinja:

{% if b.catcher == none %}
  {{ a.name }}
{% elif b.catcher != none %}
  {{ [a.name, b.catcher]|join(' ;') }}
{% endif %}

I recreated the for each loop with the condition for each position and then update each position. It works great during the first run, flawless. Pipelines will add each person's preferred fields to their assigned positions in the games table. I then have 9 positions with all the possible configurations for who can play that spot on the field.

The issue I am having arises when someone texts and says they'll be at the game after I have already ran the pipeline. I add the new person and run the pipeline, and it duplicates every person that was already in the catcher position, pitcher positions, 1st base position, etc.

My question: Is there Jinja2 code or a Pipeline technique that can re-run this pipeline and not re-add the same individuals who are already on a multi-select position(s) field on the game table?



------------------------------
Shane Miller
------------------------------
No RepliesBe the first to reply