Only the first record of a list compares with the dropdown variable
Application Type
Service Studio Version
11.50.16 (Build 51987)

I need to compare the dropdown variable with the nth item on an aggregate.list.current in order to keep the flow of my application.

Here's whats happening:

whenever I choose a dropdown item it compares with the current aggregate.list id to see if they're equal but the comparison only happens with the first item on the list, which means the only the first dropdown item will be evaluated to true. Please check the oml files for more detail


Hi Gabriel,

If you want to compare to each item of aggregate.List you need to add a For Each widget and compare to the Current item one.

I added a loop (For Each widget) into your .oml already but not ready sure what is the end 1 cycle. My guess is that you want to Save each Quote with updated status... so I end each Cycle with Quote_SaveCore. 

The idea is that, you can update as needed.

Hope this helps,



Thank you so much for the reply but this is the previous solution I was using and I got many problems using the foreach loop. I "kinda" solved the problem using system's list actions and this: aggregate.list[aggregate.list.length-1] but I'm not very sure why does this work. I guess I still don't get how aggregates and their lists work...

Captura de Tela 2021-11-01 às 09.19.12.png


Hi Gabriel,

The output of an Aggregate is just a List (more precisely a Record List), and an Aggregate is just a query. So knowing how Aggregates work and knowing how Lists work are two quite different things.

You can access the Current of a List via MyList.Current (assuming your list is called MyList; but note that what actually is the Current is not always strictly defined), but you can also get an element inside the list at a specific position by indexing (first entry is 0), e.g. MyList[0] is the first element.

A list also has a Length parameter, which tells you how many elements are in the List, so MyList.Length returns e.g. 5 if there are 5 elements. These elements are numbered 0 through 4 (0, 1, 2, 3, 4), so MyList.Length - 1 is the index of the last element, and hence MyList[MyList.Length - 1] is the actual last element. There's no magic in that, just how Lists work.

The current value is what I still don't get it. If the output of an aggregate is a list then the "current" will always be the first result, hence the problem with my application. What determines the value of current, beyond looping the list in foreach? In my example I needed to get the list value which corresponds to the drop-down variable, but it always gets the first result.

Correct me if I'm wrong, the mylist.length-1 expression will always return the tail of the list, which means it will not get middle results, right?

Hi Gabriel,

I found this topic talking about Current of List you can take a look.

For your question, as Kilian has said, the MyList[MyList.Length - 1] is always the last element. In your words, it's the tail of the list. But, please noted that MyList can be empty so need to check the Length first when using this approach. Because if the MyList is empty, then Length is 0 and result of MyList.Length -1 is -1 and it will throws error "index out of bounds".



Hi Gabriel,

for comparing each and every row of record, you need to use for each loop and provide it the record list as a source. 

Please refer for more details.

Hope it helps,




Without looking at the OML (no time, sorry), also take a look at the various List Actions, which are easier and faster than looping over data.

Yeah, listany and listall helped me solve some problems in this application, thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.