Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
4 years ago

Pipeline Idea Needed

I'm struggling with how to accomplish something in Pipelines. In a previous discussion, it was pointed out that For Each loops run in parallel, which is where this is becoming tricky for me.

Parent Table: Projects
Child Table: Materials
Child Table: Orders
(both are children to projects)

The Materials table has a 'Group' Assigned (A,B,C,D,E,F). So, perhaps 3 items are labeled group A, two labeled B, and so on. The orders table will also have a 'Group' field with the same options.

Upon a checkbox trigger on the parent table I want the following to happen:
1. Search Orders Table. Create an order with the Group Field set to either A, B, C etc. The trick is, I only want the order created with a group that exists (ie, if NO materials are labeled group D, then do not create that order). Also, if that order/group combo already exists, do nothing.
2. Right now, the problem I am having is any way I have thought to run it through a pipelines, it runs so fast and in parallel, that if two Materials items are labeled Group B, then two orders labeled group B are created (versus one being created, then pipelines realizing it has already been created, and moving on).

Any ideas?

------------------------------
Mike Tamoush
------------------------------

5 Replies

  • Step 1 - Search Materials
    FOR EACH MATERIAL
    Step 2 - Search Orders where Order Material Group = Step 1 Material Group
    CONDITION
    If Step 2 is Empty
    Step 3 - Create Order where Order Material Group = Step 1 Material Group

    ------------------------------
    Blake Harrison
    bharrison@datablender.io
    DataBlender - Quickbase Solution Provider
    Atlanta GA
    404.800.1702 / http://datablender.io/
    ------------------------------
    • MichaelTamoush's avatar
      MichaelTamoush
      Qrew Captain
      Blake,

      The problem with that is, Pipelines does not search the first material, look if empty, and if not create, THEN move to material two.

      It starts searching all triggered materials simultaneously and in parallel. So if two are labeled 'B', it will run them at the same time, look, say 'its empty' and create two at the same time with the Group B.

      Or in other words - the for each loop - all fires together simultaneously.

      ------------------------------
      Mike Tamoush
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        Mike,
        I have not tested this and don't have much experience with Pipeline failures.  But assuming that they don't turn themselves off if there are too many errors, then what if you create a formula field set to unique field which is some combination of the order and the group.

        Then let the For Each run and some of them will fail as they are essentially in a"race" condition to create the record and cannot all win.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------