How to get the next row from the database
Question
Application Type
Reactive

How to get the next row from the database 

if i have screen details ,in this screen i have two buttons (next and previous )

i need when i click on next  fetch from next row  for example  ,if i have id = 2  and the next row in an entity have id = 5

i need when i click on next  fetch from next row which id = 5 ,And vice versa when  i click on previous  .

How can I do that ?

Hello @andrew mahfouz,

Please review this post. The solution has an oml attached as well.

Another way of doing a list traversal is also discussed here. This post is a more recent one and I do prefer this approach.

Regards,

AJ

Hello @andrew mahfouz ,

--In OnInitialize It's better to get the Identifers and store them in a list

--Create a Local Variable and assign the first element from the above list [Id]

--Add filter to the aggregate in which you're getting a particular record from the database[aggregate.Id = Id] 

--When you click on Next Button, Add a Client action and find the index of the Id[local variable] and get the Index+1 element from the list and assign it to the Id, so that Id will be changed and aggregate will get refreshed and fetches the next question

--You can do in same way for back button as well, but need to decrement the Index

--Make sure to stop the flow when you're at first element[stop back click] , at last element[stop Next click]


Hope this helps, if not I'll work on it and can provide you an working sample.


Thanks,

Sandeep.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.