Forum Discussion

Jay's avatar
Jay
Qrew Member
5 months ago

Pipeline Looping Through an Array

Hi guys, I am new to Pipeline, and I need some help doing the following task: 

Loop through the first half of a text field containing many numbers separated by ";", and comparing each number to the record ID. It accepted the code but when I run it, this code popped up "Skipped because set values are the same as in source object." 

{% set array = a.j_classification.split(';') %}
{% set first_half = array | length %}
{% set first_half = first_half//2 %}
 
{% for i in range(first_half) %}
{% if array == a.id %}
{{1}}
{% endif %}
{% endfor %}


------------------------------
Jay
------------------------------

8 Replies

  • Can you post some sample data ?  I visualize you've something like 

    ABC123 , you want to split it down the middle into ABC and 123 and then compare 123 to the record id of the record ? 

    it can ABCDE12345, will it always be half the length ? never ABC13245 , since [Record ID#] keeps growing



    ------------------------------
    Prashant Maheshwari
    ------------------------------
    • Jay's avatar
      Jay
      Qrew Member

      Prashant - thank you for your response!

      An example of a.j_classification field would be "538 923 239 248 492 964 082 943".

      When pipeline loop through each record, I want to compare the record ID to the 1st four number of the a.j_classification field.

      Ex: if record IDs are 538 923 239 248, then I want to output "1" for the new field. So 4 records will be updated. 



      ------------------------------
      Jay
      ------------------------------

      • PrashantMaheshw's avatar
        PrashantMaheshw
        Qrew Captain

        I am still confused by "Loop through the first half of a text field containing many numbers separated by ";" .

        In string already without the text component  "538 923 239 248 492 964 082 943" ??

        Should we assume we are doing a nested lookup? 



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