Forum Discussion

PaulPeterson1's avatar
PaulPeterson1
Qrew Assistant Captain
3 years ago

Pipeline structure help needed

I'm probably missing something simple, but haven't been able to find the right sequence of events to make this pipeline work as needed.  Hopefully someone can point me in the right direction.

There are three tables involved in this pipeline.  We can call them Orders, Invoices and Invoice Data.  The pipeline is triggered by a checkbox field, Generate Invoice.  This will typically be checked in grid edit and can be a single order or 100s of orders that will be combined into a single invoice.  Once the checkbox(es) is(are) checked, the pipeline will start and create a new invoice record, prepare a bulk upsert in the invoice data table, search the orders table for the orders, In the loop: add a row to the upsert, remove uncheck the checkbox for generate invoice, end of loop, commit the upsert.

The problems with that flow are it is creating a new invoice for each row in the invoice data upsert and I have not been able to find a way to pull the invoice number from the new invoice record into the upsert.

I welcome your suggestions.

------------------------------
Paul Peterson
------------------------------

1 Reply

  • PaulPeterson1's avatar
    PaulPeterson1
    Qrew Assistant Captain
    I think I have a solution, just need to work out the syntax.  How could I use the {{n | count}} in a condition to see if it is equal to zero?  If it is zero, that would mean this is the first iteration and I could create the record in the Invoice table and include the invoice number in the add row to upsert.  This would ensure I only create the invoice record once.

    ------------------------------
    Paul Peterson
    ------------------------------