Is there a possibility to get a range that is sorted by two columns?
Sort by Column1 first and then by Column2
1 Date 1
2 Date 3
2 Date 5
3 Date 2
3 Date 4
3 Date 6
4 Date 7
Using SETRANGE doesn't change how your data is sorted! It only limits which rows are displayed. It's "just" a filter.
If you like to change the way data are sorted, then you have define a new key including the fields it should sort by.
In your example, then I assume that you only have two columns/fields in the Tab1 table. In that case Column1 would be the primary key (if the same date is only allowed once). So technically it would always sort by first the primary key and then the first (and only) field. If the same date is allowed more than once, then you need more fields in your primary key, otherwise the key would not be unique.
If column1 and column2 are only two fields in the table, then you would need define a new key with Column1 and Column2.
Another way that i learned about just now is to use SECURRENTKEY for two fields:
What do you think Erik P. Ernst ?
other post about this topic: https://dynamicsuser.net/nav/f/developers/7532/multiple-keys-and-how-they-are-used