How to put a counter next to a column of the "table records"?

Hey guys, I need some help from the experts, I would like to put a counter in the rank column that counts from 1 to as many records in the correct order, 1 to n, for example, if only 5 records appear in this "table records", the counter in the "rank" column would be 1,2,3,4,5.



Hi Mancciny,


You would have table widget and in the rank colum you set the expresion as below


TableWidgetName.List.Current.EntityName.Id


For example: EntityName is Student Table record widget name is Student Table --> StudentTable.List.Current.Student.Id


Ajith

Ajithkumar Radhakrishnan escreveu:

Olá Mancciny ,


Você teria um widget de tabela e, na coluna de classificação, defina a expressão como abaixo


TableWidgetName.List.Current.EntityName.Id


Por exemplo: EntityName é Student Table, o nome do widget de registro é Student Table -> StudentTable.List.Current.Student.Id


Ajith

Thanks for the help, but I don't want the entity ID, I need an accountant that is in the order. For example: the table will show the IDs: 1, 4, 12, 44, 22. But what I want is a counter in the order, for example: 1, 2, 3, 4, 5


Mancciny wrote:

Hey guys, I need some help from the experts, I would like to put a counter in the rank column that counts from 1 to as many records in the correct order, 1 to n, for example, if only 5 records appear in this "table records", the counter in the "rank" column would be 1,2,3,4,5.



Hi Mancciny,
I think you should switch to DataGrid because it's very flexible. Just like Excel.

You can do everything easily.

Dong Van Huyen wrote:

Mancciny wrote:

Hey guys, I need some help from the experts, I would like to put a counter in the rank column that counts from 1 to as many records in the correct order, 1 to n, for example, if only 5 records appear in this "table records", the counter in the "rank" column would be 1,2,3,4,5.



Hi Mancciny,
I think you should switch to DataGrid because it's very flexible. Just like Excel.

You can do everything easily.

Hi Dong Van Huyen, thank you, but i don't know how it does working, can you explain me?

What i'd like same is trying to do this without forges. Someone could help me?

Mancciny wrote:

Dong Van Huyen wrote:

Mancciny wrote:

Hey guys, I need some help from the experts, I would like to put a counter in the rank column that counts from 1 to as many records in the correct order, 1 to n, for example, if only 5 records appear in this "table records", the counter in the "rank" column would be 1,2,3,4,5.



Hi Mancciny,
I think you should switch to DataGrid because it's very flexible. Just like Excel.

You can do everything easily.

Hi Dong Van Huyen, thank you, but i don't know how it does working, can you explain me?

Hi Mancciny,

You can refer to the instructions below:

https://success.outsystems.com/Documentation/Development_FAQs/How_to_use_Data_Grid



Mancciny wrote:

What i'd like same is trying to do this without forges. Someone could help me?

Hi Mancciny ,
You can try for each loop in prepration, that will insert counter values at runtime.


Rajat Choudhary wrote:

Mancciny wrote:

What i'd like same is trying to do this without forges. Someone could help me?

Hi Mancciny ,
You can try for each loop in prepration, that will insert counter values at runtime.


Hi Rajat, I tried to do this, but I have too little experience, can you give me an example? 


Mancciny wrote:

Hey guys, I need some help from the experts, I would like to put a counter in the rank column that counts from 1 to as many records in the correct order, 1 to n, for example, if only 5 records appear in this "table records", the counter in the "rank" column would be 1,2,3,4,5.



Hi Mancciny

You can achieve this by using

.....List.CurrentRowNumber+1

of your table in expression and this is the result.


Hope this helps

Regards

Seema

Mancciny wrote:

Rajat Choudhary wrote:

Mancciny wrote:

What i'd like same is trying to do this without forges. Someone could help me?

Hi Mancciny ,
You can try for each loop in prepration, that will insert counter values at runtime.


Hi Rajat, I tried to do this, but I have too little experience, can you give me an example? 


Hi Mancciny , 

First of all make a local variable "Counter" and assign default value = 1 , and then in preparation use for each loop after aggregate and a Assign to assign value to rank(Attribute in your table). Now assign the value to Rank i.e  Tablerecords.list.current.movie.rank = counter and set counter = counter +1 . 

Also in Foreach loop properties set the StartIndex = 0 and Maximum iteration = Count of aggregate. 


Hi Mancciny,

If the number you want to show is straightforward a serial number than what Seema Pandey has suggested is the correct way of doing it. You can use it in the same way she mentioned or else if there is some logic to calculate rank than you have to put some logic and additional attribute to bind with the rank column.

Regards,

-PJ-

Pramod Jain wrote:

Hi Mancciny,

If the number you want to show is straightforward a serial number than what Seema Pandey has suggested is the correct way of doing it. You can use it in the same way she mentioned or else if there is some logic to calculate rank than you have to put some logic and additional attribute to bind with the rank column.

Regards,

-PJ-

Hi Pramod Jain, I want this numbers because I need to save into in the rank attribute. After the game finished, I want to save the rank of each player on the table. In this case, what could be the best way? 


Hi Mancciny,

Could you please tell me how do you decide the rank of a person after game finished , is it based on some logics or depended upon any other attribute?

If you know  the rank after game finished you can update his\her rank in the database entity there only (assuming you have a rank attribute in your entity) and than while showing it, show it from the same attribute.


Regards,

-PJ-

Pramod Jain wrote:

Hi Mancciny,

Could you please tell me how do you decide the rank of a person after game finished , is it based on some logics or depended upon any other attribute?

If you know  the rank after game finished you can update his\her rank in the database entity there only (assuming you have a rank attribute in your entity) and than while showing it, show it from the same attribute.


Regards,

-PJ-

Hi PJ, thank you very much for the help you are giving me.
The logic as the rating will be stored in the database will be as follows: When the player is marked as deleted, he will be given a datatime to let me know in which order he was finalized, so he will receive a rating, An example: If there are 18 players and he is the first to be eliminated, I want 18 to be stored in that player's database in the attribute I named "rank". Therefore, if the next player is eliminated, he will inherit the number 17 and so on.


Rajat Choudhary wrote:

Mancciny wrote:

Rajat Choudhary wrote:

Mancciny wrote:

What i'd like same is trying to do this without forges. Someone could help me?

Hi Mancciny ,
You can try for each loop in prepration, that will insert counter values at runtime.


Hi Rajat, I tried to do this, but I have too little experience, can you give me an example? 


Hi Mancciny , 

First of all make a local variable "Counter" and assign default value = 1 , and then in preparation use for each loop after aggregate and a Assign to assign value to rank(Attribute in your table). Now assign the value to Rank i.e  Tablerecords.list.current.movie.rank = counter and set counter = counter +1 . 

Also in Foreach loop properties set the StartIndex = 0 and Maximum iteration = Count of aggregate. 


It didn't work my friend, I'm sending prints for you to see how I did. I put the variable "Count" as integer and in expression I put Tablerecords.list.current.movie.rank


Solution

Hi Mancciny,

Check the attached oml. I have developed a small example to save the rank in the order you explained above.

I have used aggreage runtime property,"Count" to save the rank based on player is out.

However I have done this manually on button click but you can customize this according to your usecase.

Hope it helps

Regards

Seema

Solution

Seema Pandey wrote:

Hi Mancciny,

Check the attached oml. I have developed a small example to save the rank in the order you explained above.

I have used aggreage runtime property,"Count" to save the rank based on player is out.

However I have done this manually on button click but you can customize this according to your usecase.

Hope it helps

Regards

Seema

First of all i'd like to congrat everyone who tried help me here, however, the explication from Seema Pandey was perfect to answer my doubts. Thank you so much Seema Pandey.