How to select specific record from list variable?

For any particular list variable, I have found the below properties like

1. Current
2. EOF

3. BOF

4. CurrentRowNumber

5. Length

6. Empty


But how can I find  record for any specific id?

like I need to find list record for id = 5 

Is there any build-in-function?


Anyone Please give me an example 

Manish Kumawat wrote:

For any particular list variable, I have found the below properties like

1. Current
2. EOF

3. BOF

4. CurrentRowNumber

5. Length

6. Empty


But how can I find  record for any specific id?

like I need to find list record for id = 5 

Is there any build-in-function?


Anyone Please give me an example 


Hi,


Please check the List filter function.

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/System_Actions#ListFilter


Thanks

What Id are you talking about? The record Id? Or the record's 5th position? Your question is a little confused. You can explain your question better.

Hi Manish, 

I don't believe there's a built-in function for that. 

But it seems as easy as run your list and check if the id = 5 than assign the record to a variable you have previously defined. 


Does it reply your question?


Thanks,

Do you want this kind of Id:

or


Use a similar syntax like the example bellow to access using index:

GetListName.List[5].ListName.Atributte

However, depending on the scenario you are using it, it's not a best practice 


Migalhas wrote:

What Id are you talking about? The record Id? Or the record's 5th position? Your question is a little confused. You can explain your question better.

Its not for 5th position.
Is it for that record which Id is equal to 5


Manish Kumawat wrote:

For any particular list variable, I have found the below properties like

1. Current
2. EOF

3. BOF

4. CurrentRowNumber

5. Length

6. Empty


But how can I find  record for any specific id?

like I need to find list record for id = 5 

Is there any build-in-function?


Anyone Please give me an example 


Hi,


You can also check the index like .net/java way

like List[5].Text

HI!

YourVariable[4].yourfield

This will return the value from field "yourfield" from the fifth element from YourVariable list. 

Hope this help

Graça

Manish Kumawat wrote:

Migalhas wrote:

What Id are you talking about? The record Id? Or the record's 5th position? Your question is a little confused. You can explain your question better.

Its not for 5th position.
Is it for that record which Id is equal to 5



that's ok just use list filter and use condition.


Assign Source List and then appropriate condition as per ur requirement...Thanks

Hi Manish,

To sum up the answers above:

  1. If you are looking for a record with a specific value, use ListFilter, and set the right condition (e.g. "Id = 5");
  2. If you are looking for a record with a specific index, use List[index].

That's it. If any of the answers above were the solution for you, please mark it as such, thanks.

Kilian Hekhuis wrote:

Hi Manish,

To sum up the answers above:

  1. If you are looking for a record with a specific value, use ListFilter, and set the right condition (e.g. "Id = 5");
  2. If you are looking for a record with a specific index, use List[index].

That's it. If any of the answers above were the solution for you, please mark it as such, thanks.


Hi Kilian,


First is not working. Like when follow and used like below 

ListIndexOf(UserList, Name = "James")

It gives me error

like

Can't Identify 'Name' element in expression.



But the second one is working fine.


Thanks & Regards

Manish Kumawat



Hi Manish,

ListIndexOf is not a Function, you can't use it like that. Instead, use it like this: