@kuovonne
@Rupert_Hoffschmidt
So I have set of Records, I want to retrieve them in the order that I placed in the table, but API records response giving me in random order so, I’m using this field to sort them when I requesting the API using sorting method. That is the usecase, so that is why I’m using a separate field. Its working fine I have no issue.
But let say I have 100records all order sequentially in the table, now if I have to add lets say a new record in 44th place in the table, as Im use auto number that new record will be having OrderID as 101, so when I call the api I will receive that new record in 101th place instead of 44th place.
That was the challenge I was facing.
So it sounds like you’re able to sort records via API. Otherwise, this seems to be a good blog article explaining it: The right sort of API updates
When records are sorted, they are in the correct order I suppose. If you have 100 records and you want to add a 101st in 44th place, then I would splice() that record into the array at that place. Now you have 101 items in the array and it sounds like that you want to change the “order number” every time you do this. So given your sorting order, the order number is the index in the array.
You will then have to update all records accordingly. I’d create an updateRecordsArr first by mapping over your sorted records array ({id: …}, fields: {“field 1”: …, “field 2”: …}).
Does that make sense to you?