Skip to main content
Question

Help Needed with Quickbase Pipeline to Accumulate Values Instead of Overwriting

  • May 16, 2024
  • 0 replies
  • 200 views

Forum|alt.badge.img+2

Hi Quickbase Community,

I am facing an issue with a pipeline designed to add quantities to an existing field in my Quickbase app, but it keeps overwriting the existing values instead of accumulating them.

Context:

  • Tables Involved:
    • Transactions: Records of items being added or removed from containers.
    • Containers: Contains fields for tracking quantities of different items in specific compartments.
  • Fields Involved:
    • Transactions Table:
      • Action Type: Indicates the type of transaction (e.g., "Add Item to Container").
      • Container Compartment: Specifies the compartment (e.g., "Compartment A").
      • Container ID: The ID of the container to which the item is being added.
      • Item Name: Name of the item.
      • Item Quantity: Quantity of the item being added.
    • Containers Table:
      • Compartment A Quantity: Field to store the quantity of items added to compartment "Compartment A". 

Current Pipeline Configuration:

  1. Trigger: On new or modified records in the Transactions table where Action Type is "Add Item to Container".
  2. Condition: The compartment is "Compartment A".
  3. Lookup Step: Fetch the current value of Compartment A Quantity from the Containers table.
  4. Update Step: Add the new quantity to the existing value of Compartment A Quantity.

Issue:

Despite various attempts, the Compartment A Quantity field in the Containers table is being overwritten with the new quantity instead of adding the new quantity to the existing value. Here is the current Jinja expression used in the update step:

jinja

{{ (b["Compartment A Quantity"] | default(0) | int) + (a["Item Quantity"] | int) }}

Steps I Have Taken:

  • Verified the field types and names.
  • Ensured the pipeline permissions are correct.
  • Tested with different variations of the Jinja expression to accumulate values.
  • Checked pipeline logs for errors or issues.

Request for Assistance:

I am looking for a solution to ensure that the Compartment A Quantity field accumulates the new quantity with the existing value, rather than overwriting it. If anyone has faced a similar issue or has any suggestions on how to resolve this, your help would be greatly appreciated.

Thank you in advance for your assistance!

Best regards,

Tom

This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24

I do not have the skills to assist you with the technical Jinja syntax issue but if you don't mind a comment, why don't you just have summary fields to calculate the current item quantity.  If you have a relationship where one item has many transactions you can just roll up the ins and outs and have a summary field which represent the running total and that way you have a perfect audit trail with perfect math that will always add up and never be subject to say perhaps a pipeline failure.  


MarkShnierYou
Forum|alt.badge.img+24

Summary fields are very efficient. You are unlikely to run into performance issues unless you hundreds of thousands of records and say 100+ users.