"Like" button for a database in Lotus Notes - lotus-notes

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?

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)

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;""));

Related

Powerapps: button selection on a previous screen prefill a field in a form

I am attempting to build an app with Microsoft powerapps that will be writing/reading data to/from an excel sheet.
I have created a form in powerapps from a table in the excel sheet. I am curious to know if anyone knows how to fill the data in a field based on a button selection on a previous screen.
As an example let's say the following fields are in the form; Location, Action, Item, Username.
This is what I am imaging and would like to do;
I would like the first two fields to be filled by selecting buttons on a previous screens instead of a drop down menu in the edit form view. the last two field can be filled by inputting text on a thirds screen.
The flow:
Screen1; presents two 4 locations in the form of buttons*doesn't necessarily have to be a button but function like one.
4 locations: NY, LA, AZ, LN
when users selects "NY" button, "NY" is filled/stored in to the "location" field in the form and the screen navigates to the next page where the user will select the actions.
Screen2; presents two 2 actions in the form of button.
2 Actions: remove, add
when users selects "remove" button, "remove" is filled/stored in to the "action" field in the form and the screen navigates to the next page where the user will fill the other two fields in a text field.
Screen3; has two text fields where user can fill in the rest of the information for item and user name. Location and Action should be prefilled at this point. When the user submits the form all data is submitted and a row is created in the excel table with all the information captured.
any information how to make a button selection on a previous screen prefill a field in a form that would be awesome! thank you for reading.
It sounds like you want to use a collection. A collection can be used similar to a global variable and will allow us to access data on a different screen than the one we set it on.
Some useful information can be found here:
https://powerapps.microsoft.com/en-us/tutorials/working-with-variables/#create-a-collection
https://powerapps.microsoft.com/en-us/tutorials/function-clear-collect-clearcollect/
Based off of your flow, let's assume that the screens are named as follows:
Screen1 will be "SpecifyLocation"
Screen2 will be "SpecifyAction"
Screen3 will be "FinalizeInput"
The names are arbitrary, but I think they'll make the following example easier to follow.
On the screen "SpecifyLocation", we're going to create four buttons. They will all be identical, except for the name of the location they reference. For instance, the button referencing "NY" would be as follows:
Text = "New York"
OnSelect = ClearCollect( LocationMetadata, "NY" ); Navigate(SpecifyAction,ScreenTransition.Cover)
Please note that the OnSelect value is two different functions separated by a semicolon. The first function, ClearCollect(), clears all information in a collection and then writes a new entry. In this case, we have a collection named LocationMetadata into which we are writing the value "NY". The second function, Navigate(), changes which screen we are looking at.
On the screen "SpecifyAction", we're going to create two buttons. They will be similar, except for the action they refer to. For instance, the button referencing "Add" would be as follows:
Text = "Add"
OnSelect = ClearCollect( ActionMetadata, "Add" ); Navigate(FinalizeInput,ScreenTransition.Cover)
As was the case before, we've created a button that calls two functions when clicked. They are the same two functions as last time; however, we've changed LocationMetadata to ActionMetadata in our ClearCollect() call, since we want to store a different piece of information. We've also changed our Navigate() call to move us over to the "FinalizeInput" screen.
I'm not entirely sure how you've got your final screen laid out, but in any case, you'll want to access the data we stored in collections previously. This can be done with the function First(), which returns the first element of a collection.
To access our selected location, you can use: First(LocationMetadata).Value
To access our selected action, you can use: First(ActionMetadata).Value
You should be able to supplement whatever extra data is collected from your user on this final screen with the collections we set up.

How to use an InputBox with a table - Domino Designer

I would like to create a button which then opens an inputbox, the user then inputs a message, and then I would like to create a table with there name & the message in, on the same form.
Is this possible in Domino Designer?
Formula?
LotusScripts?
Not knowing the proper use case, and expecting that more than just one user will be able to click that button for a single document, let me recommend a slightly different solution:
I tend to solve these by using a simple multi value text field, make it computed when composed. Then if a user enters a message I append (or prepend) a new line to the list field like in
[Lothar Mueller, 2015-05-01 15:00:01]: this is my message

Comparing users from #username and #picklist

I have formA where I have "_reviewer" field, which is text/editable. The field is populated when the save button is clicked, the button has the following code:
pick := #Name([CN];#PickList( [Name]));
#SetField("_reviewer"; pick );
#If(#Command([FileSave]);
#Do(
#MailSend(pick;"";"";"Subject";"Body";"";[IncludeDoclink]);
#Command([CloseWindow]);
#StatusBar("Success.")
);
#StatusBar("Fail!"));
I have viewA where document should be shown if the current user is the same as the person in '_reviewer' field, the code in View Selection is:
LCName := #LowerCase(#Name([CN];#UserName));
LCPeople := #LowerCase(_reviewer);
SELECT form = "formA" & (#Contains(LCPeople; LCName))
I have another viewB, where I can see all documents, and one of the columns is '_reviewer'. Now the issue is, even though on viewB I see that John Doe is reviewer for a documentA, the documentA is not shown in viewA when John Doe is logged in as the current user. The tricky part is, documents sometimes show up in viewA, and sometimes they don't, even though I repeat the same steps when creating the document. Having this behavior is unacceptable. Is there some other way to parse the current user and the user picked from #PickList, or some other way to check if the two are the same?
Use an embedded view in a Page like suggested in your last question. This time first categorized column would be #LowerCase(_reviewer) and "Show single category" would have formula #LowerCase(#Name([CN];#UserName)). The view selection is SELECT form = "formA".
You can't use user specific functions like #UserName in public view's selection formula.
Also note, that the user can save the document by pressing Ctrl+S or by closing the window and selecting Yes when prompted. They don't have to use your Save button. If there's really something that must happen before the document is saved, it must be done in the form Querysave event. If it has to happen after the document is saved, it must be in the Postsave event. Kudos for checking the return value of the save command though!

Entering multiple values using #setfield

I have a text field/editable, allow multiple values, semicolon for both Multi-Value Options property, in which I want to save current user when they click a button. On the button I have the following code:
#SetField("fieldA"; #Name([CN];#UserName));
The previous value always gets overwritten by the new. What would be the solution to have multiple values stored in?
#SetField("fieldA"; fieldA:#Name([CN];#UserName));
That will append the current user's name to the item.
You might want to look into using the #Unique function. Remember there's a 32K limit of summary field data, so don't let this list grow indefinitely. See #Subset function. Also, bear in mind that the user can save the document without clicking your button, so a Querysave event might be a better place to do this.

How do I create a pager for a view that shows the alphabet instead of numbers?

I have a need to have an alphabetical pager for a view. I didn't see any of the samples or the custom pager that addresses this. I would think that this would be a pretty common thing.
MJ
I'm not quite sure what you really mean by an "alphabetical pager", but I assume you might be looking for some kind of alphabetical navigator like we have it in the personal NAB inside the Notes client, right?
If so you're not really looking for a pager but for an alphabetical view filter. Here's one way to get there:
create a panel, give it a distinctive ID like "viewContainer" or
something. Put your view panel into the panel; of course the view's main sorting order must be alphabetical
create a 2nd panel above "viewContainer", no ID necessary here
put a repeat inside this new panel and bind it to a new JavaScript array, like that:
new Array("a", "b", "c", ... , "x", "y", "z");
enter a collection name for the repeat, like "letter"
put a link control inside the repeat. The link's label will be
computed to the repeat's collection name, i.e. "letter".
assign an onclick event to the link setting a sessionScope variable to the current collection name's value, like that:
sessionScope.filter = letter;
set the event's refresh mode to partial so that it refreshes your viewContainer panel
highlight your view control inside the viewContainer. In its data properties look for the property field labelled "Filter by column value" and make it computed. Enter this code:
sessionScope.filter;
That's it.
Edit:
of course you can build the repeat's datasource array dynamically from the view itself. So, instead of building that static a-to-z array you could also use something like this:
#Unique(#Left(#DbColumn(#DbName(), "yourLookupView", viewColNumber), 1));
That should return an array only containing those letters that really are in your view.
Also you could another static link control outside the repeat resetting the filter to show all entries. It would be built like the repeated link with the onclick event calling this code:
sessionScope.filter=null;
Enjoy!
I would go for this: make a view categorized by formula #Left( value; 1). Then render result of #DbColumn as pager by repeat or some ExtLib component (links list, navigator, menu). Each link will either limit shown view to "single category" or jumps to "starts with" character.

Resources