Forum Discussion

JamesCarr's avatar
JamesCarr
Qrew Member
2 months ago

Pipeline to Concatenate Text and Increment Numbers

I want a pipeline that, when a record is created in table A, it will look to see if the record exists in Table B.  If it doesn't exist, create a new record in Table B.  If it does exist, concatenate the text from the new record in Table A with the existing record text in Table B separated by a comma.  I also want to add a value from a field in the new record from Table A with the corresponding value from the existing record in Table B.

For example, the new record is created with "some text" in field 5 and the number 3 in field 8.  The existing record in table B currently has "a message" in field 2 and the number 1 in field 5.  After the pipeline runs, I want the existing record in table B to read "a message, some text" in field 2 and the number 4 in field 5.

I can create the pipeline, search for the existing record, setup the condition to determine whether or not the record exists, etc.  I'm assuming I need jinja expressions to concatenate the text and increment the number.  If so, what is the jinja I need for each?   Hopefully, the solution is something simple for me to do.



------------------------------
James Carr
------------------------------

5 Replies

  • To be honest I'm not 100% sure I follow but if you just need the jinja fromatting then string concatenation is just combing values like: {{a.field_1 + b.field_2}} or adding a space or comma between {{a.field_1 + ', ' + b.field_2}} and then incrementing numbers if the source value is already an integer would just be {{a.field_3 + 1}}, maybe an int filter as well {{a.field_3|int + 1}}



    ------------------------------
    Chayce Duncan
    ------------------------------
    • JamesCarr's avatar
      JamesCarr
      Qrew Member

      Thank you, Chayce. That may be all I need. I will try to explain in more detail just in case.

      Emails for purchases are captured in a connected table. Another table is used to capture specific details from each purchase email. Names for the purchase are included. So, person A makes a purchase > email is captured > a pipeline creates a record with the desired details from the email.

      Person A makes another purchase. Rather than create a whole new record, I want to update the previously created record for person A with the additional names and an increment of the number of items. The names may or may not be given but, if they are, concatenate the 2nd purchase names with the first purchase names. 

      Does that make sense?



      ------------------------------
      James Carr
      ------------------------------
      • ChayceDuncan's avatar
        ChayceDuncan
        Qrew Captain

        Sure, makes sense. Have you thought about just trying a relationship and using summary fields? If you're able to match the email to the PO, instead of incrementing / updating the fields, you could consider just having the Pipeline fill out the 'Related PO' and then use the native summary fields to summarize the # or orders, qty or whatever, and then also use the summary combined text as well for text values. 

        The pipeline will work but using the relationship will help backfill for older emails/POs and be a little more error proof since the relationship can be adapted/changed on the fly instead of using scalar data. 



        ------------------------------
        Chayce Duncan
        ------------------------------