Discussions

 View Only
Expand all | Collapse all

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

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

    Posted 13 days ago
    Edited by Edward Hefter 13 days ago
    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
    ------------------------------


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

    Posted 13 days ago
    I'm getting an error trying to import this pipeline , maybe screenshots?

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



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

    Posted 13 days ago
    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
    ------------------------------



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

    Posted 13 days ago
    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
    ------------------------------



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

    Posted 13 days ago
    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
    ------------------------------



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

    Posted 13 days ago
    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
    ------------------------------



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

    Posted 12 days ago
    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
    ------------------------------



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

    Posted 12 days ago
    Edited by Edward Hefter 12 days ago
    I reversed the order, so that if there were found records, it would do that branch first. I ran into the same problem. When there were no records found (the "else" branch of the "if/then/else"), using {{__.id}} worked fine, but when there were records found (now the "then" of the "if/then/else") I got the same error.

    The pipeline is interpreting the {{___.id}} as the number in one instance and as the literal text {{__.ID}} in the other. I substituted the number 47 for {{___.id}} in the step where it wasn't working, and that worked fine. Of course, I need the actual record number, not the arbitrary one I picked...

    Trying to force it into an integer by using {{___.id|int}} doesn't work because Pipelines is just looking at it like text. 

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



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

    Posted 9 days ago
    Tech support at Quickbase solved this for me.

    I was searching for the existence of a record and, if that record existed, to update the original record. If the record didn't exist, to create it and update the existing record. I was trying to do it all at once - Do the search, if it is empty do A and if it is not empty do B. What I needed to do was:

    Search the records
    In the Do Loop for the search (which I had deleted before), update the original record, because if the Do Loop was looping, then a record must have been found.
    After the do loop, at the same indention level as the search, put in the condition that If the search found nothing, then create a record and update the original.

    Then everything worked. If this is confusing and you are reading this years later and want to know how I originally broke it and then how Quickbase helped me fix it, contact me about the Sunnytech App.

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



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

    Posted 9 days ago
    Thanks ED . I would still appreciate screenshots of the final working pipeline !

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



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

    Posted 9 days ago
    First find the records to work with:

    If the parent record already exists, just copy the Record ID from it in the "Do" loop from the search:


    If the parent record didn't exist, create the record and copy its Record ID in an IF/THEN statement AFTER the Search's Do Loop:

    More detail on Step H


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



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

    Posted 9 days ago
    Thanks Ed for humouring me !! Your screenshot help a lot for me to understand

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