Forum Discussion

JessicaFeauto's avatar
JessicaFeauto
Qrew Member
4 years ago

Variable assignment in Pipelines

Does anyone have experience with assigning a variable in Pipelines and changing it throughout the pipeline.

Basically, I want to assign a variable at the start of the 'for' loop and then increment it by 1 for each part of the loop.  Has anyone done this?

------------------------------
Jessica Feauto
------------------------------

6 Replies

  • No,  but I'm working with Quickbase support hoping that they will engage a senior person to work with me on this similar Pipelines issue here.  In will post back there if I find a solution.


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • JessicaFeauto's avatar
      JessicaFeauto
      Qrew Member
      Thanks Mark!  I saw your post after I posted mine.  The fact that they run for-each loops asynchronously is really a problem for my use case as well.   I've tried chaining Pipelines (ie pipeline 1 performs an action then cues pipeline 2) together to get them to run in sequence but that didn't work either.

      I sent a support request for Quickbase 2 days ago about this but they have not gotten a solution for me yet.   I'll keep you in the loop (pun intended).

      ------------------------------
      Jessica Feauto
      ------------------------------
      • UrsulaLlaveria's avatar
        UrsulaLlaveria
        Qrew Assistant Captain
        Jessica, Have you gotten a solution for this yet?

        ------------------------------
        Ursula
        ------------------------------
  • Jessica,
    I have not tried to do this exact variable (increment by 1) but you may be able to use the 'loop.index' variable to add the increment in each loop as this will increment by 1 each time through.  I'm not sure if the syntax is correct but you could try something like {% set Variable = {"value" : "[your variable] + loop.index"} %} inside the 'for' loop.  Then to user the variable is just {{Variable.value}}...  I have used similar to set a field from an outer loop as a variable that can then be used in each inner loop to get child data for each parent record in a single request body.
    Cheers,

    ------------------------------
    Roger Dartnell
    ------------------------------
    • HannahWright3's avatar
      HannahWright3
      Qrew Member

      Hey Roger,

      Do you know if it's possible to use this loop.index solution to create x number of child records based off of a numeric value on the trigger record?

      Where would you add this {% set Variable = {"value" : "[your variable] + loop.index"} %} jinja in the pipeline? As a value that you're mapping in?



      ------------------------------
      Hannah Wright
      ------------------------------
      • JoelHickok's avatar
        JoelHickok
        Qrew Cadet

        Overall, the need for a Pipeline-scoped global variable would be obvious.  I am trying to set a "running total" variable so I can tally a total for each loop and stop looping when my running total reaches a desired value.

        I don't really want to do this by creating a special field in the table and updating that field within my loop, but I will if that's the only way I can figure out.