Empty row check with next previous buttons with getrow()

I used this example to create Previous/Next button function for details windows of a table items MembersTable. Button works

=GETROW(MembersTable,-1,$[InputRow])

=GETROW(MembersTable,1,$[InputRow])

and I would like to add check to make sure either it goes back to first item or does not go beyond last item found for detailed windows. How can I create this check and grey out the button if it becomes last line or rotate it to first item? thanks

Did find a bug I believe using this feature of Next and Previous buttons. If I assign some ORDER BY on the inputRow in main Window. I see Next picks up wrong item, for example if I am at the beginning of the main item, and I press Next, then items goes to the last item and not as in the order list is showed in main window. Here is the data source i used in the main item list =FILTER(MembersTable,"ORDER BY MembersTable[Created On] DESC").

Hi @Naee-6456,

Thanks for your post! I'm happy to help you with this :slight_smile:

I'll also address your follow-up to in regards to using a filtered list (I'll show you how to set it up).

For your first ask of greying out the Next or Previous buttons, I've set up an app that does exactly that. The way is works is that if the current row is the first on the list, the Previous button will be greyed out, and if the current row is the last on the list, the Next button will be greyed out.

This is how I set it up:

I have a screen where I created two variables, which store the first and last rows of a table:

The formula for the first row in my example is =FINDROW(Item_Table)

And the formula for the last row in my example is =FINDLASTROW(Item_Table)

I'll note that I made the visibility of this block false, since it's just being used to store those values, and does not need to be seen in the app:

Now for the buttons, the Previous button shows only if the current row is not equal to the first row:

And shows the grey out button if it the current row is equal to the first row:

Apply the same concept for the Next button, where the Next button greys out if the current row is equal to the last row:

.

Now you'll have an app where the Previous button will grey out if the current row is the first row, and the Next button will grey out if the current row is the last row:

And for your follow-up post regarding a filtered list of rows, you can apply the same concept of clicking through the list. This is how I set that up:

I created a value that stored that filtered list. I used a similar formula as you: =FILTER(Item_Table,"ORDER BY Item_Table[Item] DESC")

And the first and last row variables now will look like this:

And the source of your input row drop down, will be a rowlink filter, which you will just enter your filtered list variable:

And finally, the automations of the Next and Previous buttons will have similar formulas, but refer to the filtered list instead of the table:

Now your app will have the same functionality of clicking through a list, which will be the filtered list and order you specified.

I hope these examples help! :smiley: :honeybee:

Let me know if you have any further questions.

2 Likes

Nice, thank you so much, it works :slight_smile:

1 Like

Great, I'm happy that worked for you, @Naee-6456 :slight_smile:

Let us know if you have any more building questions, we're always happy to help! :honeybee:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.