cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Blancitaloca
Regular Visitor

Canvas app gallery question...

How can I use a gallery to show a selection of items available, one at a time... I'd like the gallery to display the first item and then have the user click a "next" button to move to the next item/record instead of using a scrolling function... does anyone know if/how I can make this happen?  Many thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Blancitaloca 

Sorry - typo in my first formula.  Needed an ending paren.

Table(Last(FirstN(yourDatasource, Coalesce(lclRecNo, 1))))

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

13 REPLIES 13
RandyHayes
Super User III
Super User III

@Blancitaloca 

Typically the Gallery displays a list of Items and not just one.

You might want to consider discarding the Gallery concept and go to a single item based on a range of records.

 

However you could still use the Gallery if you've already implemented it.

For example, setting your "next" button OnSelect action to: UpdateContext({lclRecNo: Coalesce(lclRecNo, 1) +1})

Then setting your Items property of the Gallery to:

   Table(Last(FirstN(yourDatasource, Coalesce(lclRecNo, 1)))

This would give you what you are looking for.

Note: there is no logic in this for going "next" past the amount of records.  That can be added on the button or on the Items property.

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Blancitaloca
Regular Visitor

Thank you so much!!!  I have not implemented yet, how can I do the single item based on a range of records? I'm using a pretty simple excel spreadsheet with only a few records right now.  Obvs a beginner.  Thanks

RandyHayes
Super User III
Super User III

@Blancitaloca 

Can you give me a little more idea on what you are trying to achieve by having one record and a next button show at a time?

When I mentioned the range of records, it was basically the formulas that I gave.  That would establish a range in the Items property (basically one record).

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

This part does not work, gives me an error.   My datasource is "Table1" and when I set the Items property as you have below, with "yourDatasource" replaced with "Table1"... it gives me an error:  "There is an error in this formula..."

 

Then setting your Items property of the Gallery to:

   Table(Last(FirstN(yourDatasource, Coalesce(lclRecNo, 1)))

 

 

I am trying to show a catalog of available items and would like the user to see one at a time... so far, the classes I've taken only taught us galleries, but if there is another/better way, I am game to try it.

RandyHayes
Super User III
Super User III

@Blancitaloca 

Well, the bigger question then is what is in the Gallery?  If you're showing a list of catalog items, is it just a label and a picture perhaps or is their more detail and information?

 

As for the formula error - the formula works fine, did you put the formula on the Button?  Until you do that, you will have an error in the Items. 

Items property :  Table(Last(FirstN(Table1, Coalesce(lclRecNo, 1)))

Button OnSelect action:  UpdateContext({lclRecNo: Coalesce(lclRecNo, 1) +1})

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hmm, still getting an error.  I applied the formula to the "onSelect" property of the button first, then set the gallery Items property as you indicated... but still returns an error.  

 

I have a spreadsheet of about 5 different laptop models that we allow users to pick from.  It's not very complicated, but each row includes the various specs for each device (Make, Model, CPU, RAM, etc.) and I am using labels and an image link for each row.  

RandyHayes
Super User III
Super User III

@Blancitaloca 

Can you provide a screenshot of the Items property with the errors highlighted?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Blancitaloca_0-1616789726506.png

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,194)