-1

Is there a way to implement a "Like" button for a database in Lotus Notes. I basically want to have a document in Notes, where is will be possible to click a button and its then liked.

At the moment I have a button but it can be pressed as many times as they want. If possible I would like to be able to only click it once?

Jack
  • 73
  • 6

2 Answers2

2

Instead of counting the "likes", or incrementing a counter each time the button is pressed, instead save the current user's name to a list and then count the number of users in that list to tell you the number of likes.

On click this would be roughly:

ListOfLikes := @Unique(ListOfLikes:@UserName);

And then to display the count:

@Count(ListOfLikes)
Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
1

Adding to @Ken's answer, you could use a pair of buttons for "Like" and "Unlike" with hide-when formulas. For the paragraph containing the Like button

 !(@Username = ListOfLikes);

For the paragraph containing the Unlike button

@Username = ListOfLikes

(You don't need to use @IsMember for this, as comparing a scalar string against a list works the same way.)

The formula for the actual Unlike button would have to remove a name from the list, like this:

@Trim(@Replace(ListOfLikes;@Username;""));
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41