cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nagaraj007
Post Patron
Post Patron

End Users to mark favourites from gallery and view the same in Dashboard

Hello All,

 

I have got a requirement wherein I have the main dashboard and shown all the items in gallery, now the requirement is end user should have option to mark it as favourites and they should be able to view only favourites when they login every time.

 

Attached is the screen snip for your reference. 

 

Please advise.favourites.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @nagaraj007 :

After I finished the demo, I found out that @rubin_boer  had already provided a solution. I suggest you consider trying his suggestion first. You could consider letting my solution as an extended reading.

1\I assume the gallery's data source is

 

ClearCollect(GalleryDatasource,{ID:"1",Type:"Type1"},
{ID:"2",Type:"Type2"},
{ID:"3",Type:"Type3"},
{ID:"4",Type:"Type4"},
{ID:"5",Type:"Type5"},
{ID:"6",Type:"Type6"},
{ID:"7",Type:"Type7"},
{ID:"8",Type:"Type8"})

 

2\Create a SP list named 'LikeList'

vbofengmsft_0-1627890744566.png

3\Create a check box(Checkbox1)

Default

 

!IsBlank(Filter(LikeList,UserEmail=User().Email)) /*If the current user's like list is not empty, all records will be displayed by default*/

 

Text

 

"view only favourites"

 

4\Set the gallery's items property to

 

If(
 Checkbox1.Value,
 Filter(GalleryDatasource,ID in Filter(LikeList,UserEmail=User().Email).Title),
 GalleryDatasource
)

 

5\Add a "Heart" icon into the gallery

Color:

 

If(
    IsBlank(
        LookUp(
            LikeList,
            Title = ThisItem.ID && UserEmail = User().Email
        )
    ),
   Black,
   Red
)

 

OnSelelct:

 

If(
    IsBlank(
        LookUp(
            LikeList,
            Title = ThisItem.ID && UserEmail = User().Email
        )
    ),
    Patch(
        LikeList,
        {
            Title: ThisItem.ID,
            UserEmail: User().Email
        }
    ),
    RemoveIf(
        LikeList,
        Title = ThisItem.ID && UserEmail = User().Email
    )
)

 

9.gif

Best Regards,

Bof

 

 

View solution in original post

3 REPLIES 3
rubin_boer
Super User
Super User

hi @nagaraj007 you will have to create some sort of user settings which is stored in your datasource or SaveData on a mobile device. The principle is the save the methods differ for pc/laptop and mobile devices.

 

two basic steps are needed. the identifier on the dashboard item and the configuration setting in the datasource which reference it.

 

In this scenario the dashboard has an item ID for each card.  

card 1 have dashboard 1

card 2 have dashboard 2

etc

 

itentifier

your data will be something like 

ClearCollect(colDash,ForAll(Sequence(6,1,1),{dbID: Value, Name: "Dashboard " & Value, Score: the total}))

 

configuration setting, a SharePoint List call usrSettings for eg

user | setting | etc...

user 1 | "your configuration string here" {dbId:1, favorite: true}, {dbId:2, favorite: false}

 

You then lookup the favorite status for the dashboard. set the visible property of the dashboard to the lookup value.

 

Selecting the dashboard as a favorite.

Add an icon to the dashboard and set it to a heart of any icon you would like.  OnSelect of the icon UpdateContext({IsFavorite:!IsFavorite})

usrSettings

Patch(usrSettings,ID=Lookup(ID, dbID = dashboard item ID).ID,{favorite:IsFavorite})

 

I hope this will give you an idea as to how to go about it. If there are specifics you want more information on as you start this let me know.

 

 

 

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.
v-bofeng-msft
Community Support
Community Support

Hi @nagaraj007 :

After I finished the demo, I found out that @rubin_boer  had already provided a solution. I suggest you consider trying his suggestion first. You could consider letting my solution as an extended reading.

1\I assume the gallery's data source is

 

ClearCollect(GalleryDatasource,{ID:"1",Type:"Type1"},
{ID:"2",Type:"Type2"},
{ID:"3",Type:"Type3"},
{ID:"4",Type:"Type4"},
{ID:"5",Type:"Type5"},
{ID:"6",Type:"Type6"},
{ID:"7",Type:"Type7"},
{ID:"8",Type:"Type8"})

 

2\Create a SP list named 'LikeList'

vbofengmsft_0-1627890744566.png

3\Create a check box(Checkbox1)

Default

 

!IsBlank(Filter(LikeList,UserEmail=User().Email)) /*If the current user's like list is not empty, all records will be displayed by default*/

 

Text

 

"view only favourites"

 

4\Set the gallery's items property to

 

If(
 Checkbox1.Value,
 Filter(GalleryDatasource,ID in Filter(LikeList,UserEmail=User().Email).Title),
 GalleryDatasource
)

 

5\Add a "Heart" icon into the gallery

Color:

 

If(
    IsBlank(
        LookUp(
            LikeList,
            Title = ThisItem.ID && UserEmail = User().Email
        )
    ),
   Black,
   Red
)

 

OnSelelct:

 

If(
    IsBlank(
        LookUp(
            LikeList,
            Title = ThisItem.ID && UserEmail = User().Email
        )
    ),
    Patch(
        LikeList,
        {
            Title: ThisItem.ID,
            UserEmail: User().Email
        }
    ),
    RemoveIf(
        LikeList,
        Title = ThisItem.ID && UserEmail = User().Email
    )
)

 

9.gif

Best Regards,

Bof

 

 

Hello v-bofeng-msft!

Great explaining, and a great method! 

I was wondering if you could help me out with my app. I'm in a similar situation as OP, and I've used alot of your work here. My problem is that when I've marked my favorites, and i check the box to only show me the favorites, everything in my galleery dissapears, and when i uncheck the box, everything comes back. 

Any hellp is much appreciated! 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,401)