Forum Discussion

GeorgeBramhall1's avatar
Qrew Member
3 years ago

Pipeline to Pre-fill a many to many table triggered by the addition of Parent Records

I have a many to many table that includes a distance value between 2 related parent table records. When either a Parent 1 or Parent 2 record is added I want to create a record in the many to many table ... result being that for each Parent 2 there will be distance for Parent 1. Currently there are 300 records in Parent 1 and 60 records in Parent 2.  I have manually imported from a csv 18000 records in to the many to many table. 

What does the pipeline look like that creates additonal records automatically when either a Parent 1 or Parent 2 record is added.

George Bramhall

2 Replies

  • It will be two separate pipelines.

    Pipeline 1
    Trigger on Parent 1 Created.
    Create a bulk upsert
    Search all Table B Records.
    For each loop - add upsert row (creating those middle join records) 
    Then outside the loop .. commit upsert.

    Then similar but opposite for Parent 2 created.

    Mark Shnier (YQC)
    • GeorgeBramhall2's avatar
      Qrew Cadet
      Worked like a charm! Pretty powerful stuff. Thanks

      George Bramhall