Forum Discussion

RyanPeart's avatar
RyanPeart
Qrew Trainee
3 years ago
Solved

Pipelines - Get Length of List of Pipeline Rows

Hello,

I am trying to schedule a weekly calculation every Friday using Pipelines. The calculation process is as follows:

  1. Select the 20 most recent records from a QuickBase App table, sorted by a date lookup field (I also can't get this to work, but I will make another post about this issue).
  2. Define a Pipeline Rows table using the Bucket channel.
  3. For each of the 20 QB App table rows, store them all in the Pipeline Rows table.
  4. Search the 20 Pipeline Rows table to return a filtered list of Pipeline Rows whose fields match certain conditions.
  5. Search the QB App table again for all records created over the past week.
  6. For each of those QB App table records created over the week, update a field with: (# of Pipeline Rows matching the conditions / 20).

I was able to successfully return a filtered list of Pipeline Rows that match the conditions. But when I try to perform step #6 and update the records with {{length(d.record_id) / 20}}, I get this error: Validation error: Incorrect template "{{length(d.record_id) / 20}}". UndefinedError: 'length' is undefined.

Is there a different way I should be trying to get the number of filtered Pipeline Rows out of the 20 selected that match the conditions in order to use it in my calculation?

​​

------------------------------
Ryan Peart
Database Analyst
Minerva Knowledge Management
------------------------------
  • I think the Jinja you're looking for is {{ (d | count)/20 }}.

    This would return the count of records found in step D then divide by 20.

    If you're interested in learning more about Jinja I suggest checking out my blog post "What is Jinja" and my course "Intro to Jinja for Pipelines"

    ------------------------------
    Sharon Faust (QuickBaseJunkie.com)
    Founder, Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------

8 Replies

  • I think the Jinja you're looking for is {{ (d | count)/20 }}.

    This would return the count of records found in step D then divide by 20.

    If you're interested in learning more about Jinja I suggest checking out my blog post "What is Jinja" and my course "Intro to Jinja for Pipelines"

    ------------------------------
    Sharon Faust (QuickBaseJunkie.com)
    Founder, Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------
    • RyanPeart's avatar
      RyanPeart
      Qrew Trainee
      Hi Sharon! Thanks for getting back to me.

      I tried using {{ (d | count) / 20 }} and the Pipeline can successfully run now. But I don't think (d | count) returns the count of records from step D. When I test run the Pipeline, step D does return a number of rows, but the final records get updated with the value 0.

      Is there a different syntax I can use with Jinja?

      ------------------------------
      Ryan Peart
      Database Analyst
      Minerva Knowledge Management
      WA
      ------------------------------
      • Quick_BaseJunki's avatar
        Quick_BaseJunki
        Qrew Captain
        It may be that you need to use step E (or another step). In that case it would be {{ (e | count) / 20 }}.

        ... it's a little hard to tell from the image.


        Basically, {{ e | count }} will give you the number of records returned in a search (assuming your search step is E), but I'm not sure what step your search is in.

        ------------------------------
        Sharon Faust (QuickBaseJunkie.com)
        Founder, Quick Base Junkie
        https://quickbasejunkie.com
        ------------------------------