Skip to main content
Question

Last iteration of the Search step

  • September 10, 2023
  • 0 replies
  • 125 views

How can i identify that the last iteration of the Search step?

On the last iteration, i would like it to stamp a field but I havent found a way to do this through jinja (at least in the way i want it)

this works in getting me the highest record id (which is my default sort for the table):

{% set highest = a|max(attribute="id") %}
{{highest.id}}

and i can use this in the look up step and find the last iteration of the loop, however, i would like to not have to do this part.

on the for each after the Search step, i am trying this:

{% set highest = a|max(attribute="id") %}
{% if a.id == highest.id %}
    {{TRUE}}
{% endif %}

but i just keep getting a TypeError: 'Record' object is not iterable.

does anyone happen to know how to stamp a field in a for each loop only when it is the last iteration of the loop?

Thank you!



------------------------------
Tim D
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+11

This is from one of my working jinja code , I believe loop.last is what you want , you will loop.last==true and then your code 

        {% for i in range(a.enquiry|int) %}        
{ 
          "22":  { "value" : "{{loop.index}} of {{a.enquiry|int}}" },
          "6":  { "value" : "{{a.id}}" }            
}
                                    
{% if loop.last == false %},{% endif %}
{% endfor %}



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