list.current

  

What data will be hold by list.current when list is empty?? 

Hi Sana,

You will be able to access it but everything will be empty. The simple data types will be empty and the records will have all the variables inside it empty.

Hope this helps.

Regards,

Marcelo

Hi Sana and Marcelo,

May I improve and perheps make a small correction to the given answer?

The Current of a list is a variable whose type is the same type of the list itself.
By itself, it does not depend on the list content.

Changing the Current values will have absolute no impact in the list, while changing the list directly (through the [ ] operator will also make no changes in the Current variable.

The Current is initialized when an aggregate / sql is executed, when you click an item in a Table Records or List Records in a screen or when you iterate a list using a ForEach.

In the first case, after the list is filled the first item in the list is copied to the Current.
In the second case, the clicked row item is copied to the Current.
In the third case, from start to end, the actual row is copied to the Current each step of the loop.

But, what if the list is empty?

Like I said in the beginning, the Current is a variable of the same type of the List. If the list is empty, Current will hold the default values for the types. Like, if your list is User List (User entity record list), Current will be User Record, and the Id will hold value 0, Name will be an empty string "", IsActive will be False, etc. 

So, it is not correct to say the Current is "empty", I think, as the Current effectively exists and you can use it, and there are values in it (default values of the data type or user default values if defined).

Hope this helps.

Cheers. 


Hi Eduardo,

Never said that current would be empty. I said the types inside would be empty. But yes you are right empty is not the correct wording. As you said the types will have their default values would be a better answer.

Regards,

Marcelo

thank you for your answers... 

I am confused with the two options... 

Does this list.Current will points empty record of entity or a null value.. ?

 If the list is not a userlist...its just an empty list will no values.. 

Hi Sana,

list.current will contain a record of the entity of that list with all the fields with their default values.

In this link you can check the default types https://success.outsystems.com/Documentation/10/Reference/Data/Data_Types/Available_Data_Types

Regards,

Marcelo

Hi Sana,

List.Current will hold the default values of the variables, when list is empty.