Create unique ID for each row in repeater, that will stick with the row during sorting and paging

repeater-widget

#1

I am trying to create functionality within a repeater widget that will have a column called ID where the number in this column will be a unique value I can “sort” on as well as reference for the item row it is a part of. Currently I can put a number in the ID field in the “data set” for the repeater and it will be the same for every current item or new item. I can also manually enter a random or sequential number in the field only this will not do since I need to be able to have this new unique ID to be a part of the “Add” new row functionality. If I use [[Item.index]] in the ID for the dataset and new rows field I can have a unique number generated and each new item will have a unique ID, BUT it fails when I try to sort on the column or any column as this “index” number does not stick with the row. Also, if I do paging the ID number always starts at “1” for each new page. I want the ID to be unique and stick for the existing row and new row. Any ideas?


#2

Try creating your ID number outside of the repeater, and use the repeater’s .itemCount or .visibleItemCount property. You can do this right in the “fx” function for your ID column in the Add New Row action. For instance, if your ID values are sequentially numeric, you can set the “ID” column to something like this: [[LVAR1.itemCount +1]] where LVAR1 is a local variable pointing to your repeater widget.


#3

Its not working. I seem to be missing something here.

I set up the call for the ID column to be [[LVAR1.itemCount +1]] in OnItemLoad and LVAR1 is set to the repeater widget.

All I see is the [[LVAR1.itemCount +1]] call for each ID cell.

Do you have a basic example you can show me using this?


#4

Take a look at this demo: repeater add-sort.rp (60.7 KB)

I think what you’re missing is that the action and formula are intended to be done outside the repeater, not in the OnItemLoad event (which is inside the repeater.) Take a look at the OnClick for the “Add a Row” button.


#5

Thank You!! Now I see. Yes, you are right I was adding the call IN the repeater. In looking at your example I see how you are doing it, and how I was close but WAyyyyyyy… off :slight_smile: