Skip to main content
Question

Help using Multiselect fields in a pipeline with more than one item selected

  • December 14, 2021
  • 0 replies
  • 231 views

EdwardHefter
Forum|alt.badge.img+3
I have a multi-select field called [food] that can have any or all values of things like peas, corn, bread, pasta, chicken, etc. I want to run a pipeline that copies records from a template table into the today's menu table. I am using a search records step that has {23.HAS.{{a.food}}} in it. Field 23 is the field to match in the template table and it has only one value in it (like peas, or corn, or bread). It is now a text field, but I can change it to a different kind of field if it helps.

The search works great when there is only one value in {{a.food}}, but if I have multiple values (like peas;corn), it fails because there is nothing in the template table that has peas AND corn in it.

How can I find all the records in the template table where field 23 matches ANY of the entries in {{a.food}}? On a whim, I tried doing the query backwards {{{a.food}}.HAS.23}, but that failed even when field 23 was a mutli-select field.

------------------------------
Edward Hefter
------------------------------
This topic has been closed for replies.

QuickBaseJunkie
Forum|alt.badge.img+15
Challenge Accepted!

This seems to do the trick.

  1. "set" the multi-select field into a Jinja list using the 'split' variable on the semicolon
  2. Iterate on the list using the "for" statement to create the advanced query expression
  3. Use "if" and "loop.last" to avoid adding an 'OR' at the end of the query

To learn more about using Jinja in Pipelines, I have created a course called Intro to Jinja for Pipelines.

{% set list = a.food.split(';') %}
{% for item in list %}
{% if loop.last %}{23.HAS.'{{item}}'}
{% else %}
{23.HAS.'{{item}}'}OR{% endif %}
{% endfor %}​


------------------------------
Quick Base Junkie
------------------------------