6.5.2 Repeat Table Sorting
The list in the repeat table can be sorted in different ways, either manually or automatically.
Manual sorting
Manually is the default setting for repeats. The entries are listed in the repeat with the first on top and the last item to be entered on the bottom:
The user can change the order by pressing the cog wheel button and selecting Change order:
And then move the items up or down individually.
Note: In Zegeba v. 4.6 and earlier, this sort option was called None.
Subform Key sorting
A subform is the technical name for each entry, or line, in a repeat. Each of these lines have a unique number called the subform key, a number that counts upward for each new entry in the repeat. The keys are normally not shown but you can switch them on with Show subform keys:
Even when hidden, these keys can be used to sort the lines in the repeat table. Sort Direction Ascending will give the normal order, with the first entry on top. The difference from Manually is that there will be no option to change the sort order. Sort Direction Descending will place the latest entry on top.
Note: In Zegeba v. 4.6 and earlier, there was just one option, to sort by Subform key ascending.
In the repeat pictured below, we entered Ranya first, then Andrea, and lastly Benny:
Description sorting
The option Description can be used to sort entries according to their content. In the example below we have chosen to list the students according to their age, with the oldest students on top. This is done by selecting Description and Sort Direction Descending, and then entering in the repeat’s Description Formula field {#age}, where age is the element ID of the element Age. Select Sort Direction Ascending to place the youngest students on top. (Note: in Zegeba v. 4.6 and earlier, there was just one option, to sort by Description ascending).
As we see, the ages will then be listed in the column normally user for the form sequence number (1, 2, 3 etc.). We can choose to not display the column Age, and type the word Age in the Description Formula field: Age {#age}.
None sorting
Select this option to have the items listed downwards as they are entered, without any manual sorting available. (Note: in Zegeba v. 4.6 and earlier, this option was called Not sortable).