I would like to have a *like* button for users on a gallery which is comment , where people can come and press a like on the comment or remove the like but It should be only enabled once per users . once the user hover over the counter for the likes then then people who have like the comment should be seen in another gallery.
I found a related video to this thing but unfortunately the data was called from Excel sheet and I would like to have it from a Sharepointlist for which the method is different.
(15) HOW TO: Add 'Like' Functionality To PowerApps - YouTube
Alright Bryan thanks for clearing it out to me and I will create a new post and adresse this problem there sorry I am new to this so yea 🙂
@Anonymous wrote:@WarrenBelz @I understand thank you for your help so far, Its kind of you to take an extra step to help me out😁. @BCLS776 Do you think the problem lies with the patching of Post comment or Likes icon? For reference scroll to the previous posts here.
@Anonymous as Warren points out, this thread deviated a long way from the initial question, which makes it confusing not only for me to respond, but even more confusing for other users who want to learn from this thread. Could you finish this one off by selecting a solution to your original query and then starting a new post with a specific question?
The one thing I am wondering as I review this thread - it looks like you are trying to store comments and count "likes" on those comments, but that you are also trying to store data about specific likes on the same list? If I've got that right, there is an underlying data structure issue that will cause more problems for you - you are trying to store two different schema in the same list. Or, I misunderstand the situation. Perhaps your next post should address whether you've got the data structured correctly?
Regards,
Bryan
@WarrenBelz @I understand thank you for your help so far, Its kind of you to take an extra step to help me out😁. @BCLS776 Do you think the problem lies with the patching of Post comment or Likes icon? For reference scroll to the previous posts here.
@Anonymous ,
This is getting beyond you post subject (which I only came in on as a result of the PM you sent me). Before we go any further, is your initial query solved?
I am sorry, but I do not have the time in the next few days to debug your second query - as @BCLS776 responded to your post, I will have to leave it with Bryan.
Hi sorry I have explained it in a very bad way so basically I wanted the number of likes to be shown as per the users who pressed the liked button but it seems that functionality is working with the post comments as it is showing total number of comments that the users who posted the comment rather than likes .
Below is the code for Gallery where the numbers of likes and comments are being displayed
With(
{
records:
Filter(
'IT Helpdesk Comments',
CommentsID = Gallery_ActiveTickets_1.Selected.ID
)
},
ForAll(
Sequence(CountRows(records)),
Patch(
Last(
FirstN(
records,
Value
)
),
{rowNumber: Value}
)
)
This is the Onselect property of the post comment where, when a user comments in Richtext editor , it is then being patched to the gallery .
Patch('IT Helpdesk Comments',{CommentsID:Gallery_ActiveTickets_1.Selected.ID,Comments:RichTextEditor1.HtmlText & User().FullName & " - " & Now() }); ResetForm(Form2);Reset(Gallery3);
With(
{records:'IT Helpdesk Comments'},
ForAll(Sequence(CountRows(records)),Patch(Last(FirstN(records, Value)), {rowNumber: Value}))
)
Then comes the part where the Like Icon Onselect property code is being patched
Patch(
'IT Helpdesk Comments',
Defaults('IT Helpdesk Comments'),
{
LikesID:ThisItem.LikesID,
CreatorEmail:User().Email
}
)
Display mode property of the Like icon
With(
{
wFilter:
Filter(
'IT Helpdesk Comments',
CreatorEmail = User().Email &&
LikesID = ThisItem.LikesID
)
},
If(
CountRows(wFilter)>0,
DisplayMode.Disabled,
DisplayMode.Edit
)
)
Text property of the Label where number of likes counter is being shown
With(
{
LFilter:
Filter(
'IT Helpdesk Comments',
LikesID=ThisItem.LikesID
)
},
If(
CountRows(LFilter)>1,
Text(CountRows(LFilter)) & " people likes this ",
CountRows(LFilter)=1,
"One Person likes this ",
"Be the first to like this "
)
)
Then here is the Onselect property of the Label of Number of likes
With(
{
wFilter:
Filter(
'IT Helpdesk Comments',
LikesID = ThisItem.LikesID
)
},
If(
CountRows(wFilter)>0,
Set(
ShowWhoLiked,
true
)
)
)
@Anonymous ,
Sorry I am a little lost as to what your issue is - the code you have posted (please do it all in Text) seems correct. Wat is not working and what code is involved?
Thanks alot for the amendment it helped , Alright so more weird problem that I am facing now, So far the functionality is working but not on the like button but instead its detecting the number of counts from the Comments section .
So when I post a comment the counter increases for the people who likes this label .
and the post comment Onselect code is here below that I patched .
Patch(
'IT Helpdesk Comments',
{
CommentsID: Gallery_ActiveTickets_1.Selected.ID,
Comments: RichTextEditor1.HtmlText & User().FullName & " - " & Now()
}
);
ResetForm(Form2);
Reset(Gallery3);
and for the like button the Onselect property is below.
Do you think the problem is connected to gallery because in the same gallery I am trying to integrate two different functions ( Comment and like) and they seem to be now inteconnected but in wrong way. Here below is the patching for gallery
@Anonymous ,
Amended on initial post
I tried and unfortunately the counter where the number of likes are added does not work ,
It gives me the error report invalid argument. Expecting one of the following: Text,Number,Boolean,optionSetValue,ViewValue.
I dont know if this is important or not but I also added on the on select part the following statement
So that when I can create the gallery I can show peoples image and make the Showwholiked gallery visible when clicked on to the likes seen.
@Anonymous ,
You just need to watch your brackets - a hint for you, always indent your code as you write it - you will pick a lot of syntax issues visually
With(
{
LFilter:
Filter(
'IT Helpdesk Comments',
LikesID=ThisItem.LikesID
)
},
If(
CountRows(LFilter)>1,
Text(CountRows(LFilter)) & " people likes this ",
CountRows(LFilter)=1,
"One Person likes this ",
"Be the first to like this "
)
)
MS.Ragavendar
14
LC-26081402-0
10
stampcoin
6