I'm new to Outsystems development so I'm probably missing something. I was following along to an article, "Paginating, sorting and filtering data from a Data Action", and followed it to the best of my knowledge.
I created For Each on a Data Action leading to a list append. The problem is it's appending the same record over and over. It doesn't ever move to the next items in the Data Action. I know my Data Action has other rows as I output it to a second table just to verify. Even if I hard code the Start Index and Max Iterations it still outputs the same row over and over.
Any suggestions on how to fix this?
I tracked down the issue and it didn't have anything to do with the List or the Data Action. After debugging and stepping through I saw the List was getting the right list of rows.
I originally created my table from the Data Action, after adding the list and populating it I changed the table source to the List, not realizing I would have to go to each row cell and update it's value to use the new List.
Hi ,
Create a Screen action in pagination and assign NewStart Index parameter to StartIndex and then refresh the dataaction on only on demand.
FYI see the below attachment
Thanks,
Ravichand GY
I believe you're referencing this article. The key difference here is that all data is sent to the client side through a Data Action, and pagination occurs on the client side. This means when you navigate to another page, it doesn't request the next set of data from the server; instead, it uses the data previously fetched by the Data Action. Looks like you might have missed some steps resulting in same records in all the rows. Attached a screen grab of how this is implemented.
I went step by step through your video and can't see anything that I missed. The only difference I can think of is my Data Action is pulling from SQL Server stored procedure.
In this image the top table is using my Local Variable list that I'm appending to, the bottom one is just an output of the Data Action. The list is just getting the same row inserted over and over.
I've tried hard coding the StartIndex of the For Each to different numbers as well and it still only outputs the first row of whatever is in the Data Action.
Hi Tim,
Rule #1 in cases like this, is debug. Run the code in the debugger, and check what the value of GetSyncHistory.Out1.Current is, an check what is actually ListAppended to the PagedData list. After you've done this, please let us know the result, so we can help you better.
The issue with a repeating entry in a loop is due to an incorrect iteration condition or settings, so it's worth checking the loop conditions carefully to make sure it correctly moves to the next element in the data set. You also need to ensure that the Data Action returns the expected results and that there are no problems with filtering or sorting the data that are causing the same record to be repeated. If necessary, you can debug the cycle to identify possible problems and solve them.