Discussions

 View Only
  • 1.  Help using Multiselect fields in a pipeline with more than one item selected

    Posted 12-14-2021 01:29
    Edited by Edward Hefter 12-14-2021 01:31
    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
    ------------------------------


  • 2.  RE: Help using Multiselect fields in a pipeline with more than one item selected

    Posted 12-14-2021 12:29
    Edited by Quick Base Junkie 12-14-2021 12:30
    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
    ------------------------------



  • 3.  RE: Help using Multiselect fields in a pipeline with more than one item selected

    Posted 12-14-2021 12:59
    That worked perfectly - (Thank You!)^3

    ------------------------------
    Edward Hefter
    www.Sutubra.com
    ------------------------------



  • 4.  RE: Help using Multiselect fields in a pipeline with more than one item selected

    Posted 12-14-2021 13:37
    Awesome!

    Thanks for letting me know 🥳

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



  • 5.  RE: Help using Multiselect fields in a pipeline with more than one item selected

    Posted 15 days ago
    This worked perfectly for me as well.

    I had to change from HAS to EX, but otherwise exactly what I needed.

    Thanks!

    ------------------------------
    Eric Haseltine
    GrantWorks
    ------------------------------