Entering multiple values using #setfield - lotus-notes

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.

Related

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

"Like" button for a database in 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;""));

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!

Getting Value Picker and HughesConnect Viewpicker combination in XPages

I have an application that uses the Ext Lib value picker from a view and it works but it is very cludgy. The reason is that there are over a thousand choices and the user has to scroll through them all to get to where he/she wants to go. I want to use the HughesConnect.com picklist CC, which is very nice. However, I am having trouble with a particular issue that is probably very simple but I can't figure it out.
I want to be able to use the HughesConnect.com picklist CC to grab one value at a time and put it into a field. Then, when the user clicks on the button again, I just want them to have the ability to grab a value and append it to the same field. Every time I run it now, it is just overwriting the field. I can't use Multi Value in the CC because the view has multi values in the column from the same document. I have found that if this is the case, it doesn't work. No matter what I try. I am not very good with arrays in XPages, so I am likely doing something wrong and to be honest, I don't even have any sample code because everything I have tried hasn't worked.
I am starting to wonder whether it's even possible but it sounds so simple that it must be.
The Value Picker allows you to add a search with a view data source. Is there a reason for not using that? I can't remember if search support multi-select. It may not.
If you want to use Mark's view picker, how about getting a bit creative. Push the value into a Hidden Input field that has an onChange event. In the onChange event, append the value to a different multi-value field. If you bind the Dojo List Text Box to your multi-value field, it will make it easier for users to deselect entries. It's a bit creative, but should produce exactly the result you're looking for.

Excel User Form, Previous Button

I have an excel user form for data entry, at the moment the form functions so that users can add data. I would like to add a previous,next, first and last case button so that users can make edits via the form. The code I used for the form was derived from this website: http://www.contextures.com/xluserform02.html
If someone could describe how to add those command buttons to that form I would be very appreciative!
Thanks!
I have a tutorial on my site that almost does what you want.
http://www.dailydoseofexcel.com/archives/2004/09/09/linking-userforms-and-worksheets-part-v/
It uses a scrollbar instead of buttons, but you may be able to adapt it. The basic steps are
Load the current row data into the form
Store the current row
When a button is pushed, change the stored row (to +1, -1, the first row, or the last row)
Load the new row's data
Then you have to have code that determines if the current record has been changed. If it has, you have to write the changes or give the user the option to write or discard.
Also, you may want to disable the First and Previous buttons if the user is on the first record. Similar for Last and Next and the last row.
The tutorial on my site has all that code and a downloadable workbook that you can follow along with. Good luck.

Resources