Forum Discussion

EdwardHefter's avatar
EdwardHefter
Qrew Cadet
2 years ago

Pipeline views {{e.id}} as the text "{{e.id}}" rather than the record ID number

This one has me confused. I have a step in a pipeline to update a field in a table with the record ID from another record in another table. I have a search in step E for records that match a criteria. If the records don't exist, the pipeline makes one and captures that new record's ID in the original record. If the record does exist, it (tries to) copy the record id of that record into the original record.

For some reason, Pipelines is seeing the record ID as the literal text {{e.id}} rather than the number. But, when it creates a record, it has no trouble using {{f.id}} (the created record) as a number.

I've included the YAML since I've spent an hour trying to figure out why one branch works and the other doesn't.

Any help on how to get the existing record ID copied over? Either what am I doing wrong, or a possible work around?


The specific error is:
    • Validation error: Incorrect template "'{{e.id}}'". ValueError: invalid literal for int() with base 10: 'id'
    • Input/output
Input (Mapping)
ready_to_import:"Importing this record"
pcb_scans_record_id:"'{{e.id}}'"


The record that worked is:
Input (Mapping)
ready_to_import:"Importing this record"
pcb_scans_record_id:"22"
Output
ready_to_import:"Importing this record"
pcb_scans_record_id:"22"
id:"351"


And, for those who have stuck around this long, here's the YAML:
# Sunnytech - Move BOMs from PCBA Upload Table to PCB Scan Table
#
# Takes all of the records in the PCBA Upload Table and moves them to the
# Scans tables
#

# Account slugs:
# - quickbase[28nbQjo]: SunnyTech App <None>
---
- META:
name: Sunnytech - Move BOMs from PCBA Upload Table to PCB Scan Table
description: Takes all of the records in the PCBA Upload Table and moves them
to the Scans tables
- TRIGGER quickbase[28nbQjo] record on_new_event -> a:
export_fields: '"Ready to Import" <12>'
on_add_record: 'false'
on_delete_record: 'false'
on_modify_record: 'true'
table: '"SunnyTech Serial and Lot Tracking: PCBA Upload Table" <bsj24w3rd>'
trigger_fields: '"Ready to Import" <12>'
trigger_on_all_fields: 'false'
___: ___
FILTERS:
- AND:
- ready_to_import equals Importing Records to PCBA table
- QUERY quickbase[28nbQjo] record search -> b:
export_fields: '"Calculated Assembly PartID" <12, 11, 7, 9, 14>'
table: '"SunnyTech Serial and Lot Tracking: PCBA Upload Table" <bsj24w3rd>'
___: ___
- b<>LOOP:
- DO:
- IF:
- AND:
- b<>upload_problem set
- THEN:
- b<>ACTION quickbase record update -> c:
___: ___
ready_to_import: PROBLEM - Won't be imported!
- ELSE:
- b<>ACTION quickbase record update -> d:
___: ___
ready_to_import: Preparing to import this record
- QUERY quickbase[28nbQjo] record search -> e:
export_fields: '"ComponentID" <7>'
table: '"SunnyTech Serial and Lot Tracking: PCB Scans" <bse7txtrg>'
___: ___
FILTERS:
- AND:
- component_id equals {{b.calculated_assembly_part_id}}
- IF:
- AND:
- e<> empty
- THEN:
- ACTION quickbase[28nbQjo] record create -> f:
table: '"SunnyTech Serial and Lot Tracking: PCB Scans" <bse7txtrg>'
___: ___
component_id: '{{b.calculated_assembly_part_id}}'
- b<>ACTION quickbase record update -> g:
___: ___
pcb_scans_record_id: '{{f.id}}'
ready_to_import: Importing this record
- ELSE:
- b<>ACTION quickbase record update -> h:
___: ___
pcb_scans_record_id: '{{e.id}}'
ready_to_import: Importing this record
...



------------------------------
Edward Hefter
www.Sutubra.com
------------------------------

12 Replies

  • PrashantMaheshw's avatar
    PrashantMaheshw
    Qrew Assistant Captain
    I'm getting an error trying to import this pipeline , maybe screenshots?

    ------------------------------
    Prashant Maheshwari
    ------------------------------
    • EdwardHefter's avatar
      EdwardHefter
      Qrew Cadet
      The first step searches for already existing records with the assembly partID in it:

      If there are no records, create the record and copy that record ID into the original record. Here's the overall view, then the expanded view on the Update step (G):



      If the record already exists, here's the step to just update the original record:



      ------------------------------
      Edward Hefter
      www.Sutubra.com
      ------------------------------
      • EdwardHefter's avatar
        EdwardHefter
        Qrew Cadet
        I've also tried taking out the text field to update ("Ready to Import") so there is only the "PCB Scans Record ID" field, but Pipelines still treats it like the text rather than replacing it with the number.

        The weird thing is, it works in step G just like it should, but it doesn't work in step H.

        ------------------------------
        Edward Hefter
        www.Sutubra.com
        ------------------------------
  • I'm not sure if this will help but for all of my pipelines, I end up turning my record ID field into an integer in the pipeline Query step by adding "|int" into the field as seen below. SS also provided. Not sure if that will help but I've never had any issues with pipelines on the record ID side with this trick.  

    {{a.id|int}}



    ------------------------------
    Jen Black
    ------------------------------
    • EdwardHefter's avatar
      EdwardHefter
      Qrew Cadet
      Thanks Jen,

      It's a good idea and it's worked for me in the past, but it didn't work this time. It seems like the pipeline is actually trying to put the text "{{e.id}}" or "{{e.id|int}}" into the number field, rather than the record number itself. I'll upload pix in response to Prashant's post.

      ------------------------------
      Edward Hefter
      www.Sutubra.com
      ------------------------------
      • PrashantMaheshw's avatar
        PrashantMaheshw
        Qrew Assistant Captain
        Honestly the [pipeline] looks simple enough,

        I would definitely try to run a smaller pipeline for my scenario 2 , Which means the filter of is empty is not working , Or at least reverse the scenario where we check for [pipeline] is empty


        .making sense ??

        ------------------------------
        Prashant Maheshwari
        ------------------------------