getDocumentByKey with view category separated by "\\" in XPages - xpages

I got a view where the fist column is categorized by one field and the second column is categorized with more values separated with "\".
I now try to get a document by key, it does not work until I remove the category option from the second column. I tried getEntryByKey, getAllEntriesByKey, getDocumentByKey, getAllDocumentsByKey in SSJS and in Java. I tried it just for fun with an LotusScript Agent and it works.
Another way that works is createViewNavFromCategory. But I also have some views where the first column is only sorted and of cause than this solution does not work for me.
Is that an known issue? Is there a way to work around this problem?
UPDATE:
I just want to use the first column for getDocumentByKey

I'd suggest trying in a Java agent. If that doesn't work, I'd raise a PMR. There are some differences between Java and LotusScript, so it's possible that it doesn't work. I found a similar inconsistency with number values (which should be fixed in 9.0.2, I believe) http://www.intec.co.uk/apparent-java-getalldocumentsbykey-getallentriesbykey-bug/
It may be that "\" gets escaped in Java, so you may need extra characters, same as you would in Formula Language

Related

Excel named range not accepting "_rollsroyce"

I'm making a dependent drop down list. I've made it using named ranges. All my items and sub-items work without a problem. Except the one item called "Rolls Royce". I have multiple multiple word items with the same syntax that do what they need to do. If I change the words it works fine. Can someone please explain if this is some kind of secretly protected/banned word?
** Still haven't found a solution. I tried other double words and the give me no issue. I found somewhere that "R" is reserved but adding "_R" should solve it. Any suggestions?
I find that for names etc then the space between words has to be avoided.
I would use "Rolls_Royce" in that case as it reads the same.

How can I get a Lotus Notes search formula to work for fieldnames that contain underscores?

I tried a search formula in xpages using a field name containing underscores, and I got syntax errors.
My search is very very easy
FIELD HR_FullName CONTAINS <value> or
FIELD HR_FullName CONTAINS Bryan
This says that query is not understandable. In fact, any field with an "_" in it gives query is not understandable. If I use a field without an underscore then it works.
I deleted the index and recreated it, but it still had this problem.
Am I going crazy or doing something wrong????
Yes the question was answered. The problem was that I had changed the definition of a field (or more than one) and the UNK table only lists one entry for field name, so when you try to do a search you can get this error. Knut added in a link to someone who had a similar issue.
The link had a way to rebuild the UNK table. My solution was just to replicate the db locally, delete the server version, and re replicate up. That fixed it.

Get field names in Formula Language

I'm almost certain there's a way in the Notes Formula language to get the names of items ("fields") on a document, but I can't remember it, and there's no cross-reference from NotesDocument.Items in the documentation.
Okay, I thought of a place where I used this, and dug it up. It's #DocFields. I had been trying #DocItems, #GetItems, etc.

form not picking up data from another database

I have a form. When I open the form the two fields called office and group should be picked up from another database named something like staff.nsf. The data is picked up based on the applicant name as key. I have included my name in staff database. But the form is not picking up the two fields from the staff database.
The field formula goes like this,
server := #Name([CN]; #Subset(#DbName; 1));
temp:= #If(Applicant != ""; #DbLookup( "" : "NoCache"; server:"Mast\\Staff.nsf";
"ByApplicant";Applicant; 2); "");
#If(#IsError(temp);"";temp)
Is it a system bug? Can anybody help please.
Regards,
Priya
Lotus Notes is more than 20 years old, and extremely well-tested. It is very unlikely that you have found a "system bug". There are any number of possible problems here, and you need to carefully rule them out until you find the actual problem.
The first thing you should do is take the #IsError out of the formula (temporarily). By having it there, you are suppressing a potentially useful error message. Ok... admittedly the error messages are usually not that helpful, but sometimes they are. If you don't want to take it out of your formula, just add another computed-for-display field with just the #DbLoookup -- and follow Ken's advice about hard-coding everything.
Then review all of the following:
Is "mast\staff.nsf" the correct path for the database?
Do you have access to the database?
Is "ByApplicant" the correct name for the view? (Spelling errors happen!)
Do you have access to the view?
Do you have access to the documents in the view?
As Ken mentioned, is the first column in the ByApplicant view sorted?
Is the name value you are passing for Applicant in the exact same format that appears in the view column? (I.e, if it appears in abbreviated form in the view column, make sure that you are passing it to #DbLookup in abbreviated format.)
Does the second column of the view contain the value that you are trying to read? (Check out the rules for counting columns in the documentation for #DbLookup.)
A few thoughts:
The ByApplicant view needs to have its first column sorted alphabetically and that column should be the list of applicant names you are matching on
Try hard coding the value for applicant in the #DBLookup to see if it works, and to rule it out as the problem.
This does not work on the web, only on the client (I believe)

SharePoint: Calculated Column Values Disappear When Editing List Item. Any ideas?

I have a calculated column in a custom SharePoint 2007 list, with the following formula:
=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))
If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item.
So, on creation: "IR-40-TheTitleIsHere", but after edit, it is, "IR--TheTitleIsHere".
Anyone have some insight on why this would be happening?
I confirm the behavior mentioned above. Any Add/Edit will wipe out the [ID] portion. If you edit the column in the list and update the formula, it will update ALL list items to be correct (until you do an edit on the item).
I found this post that mentions the same problem.
Sounds like the only solution would be to make a simple workflow using SharePoint Designer that would update a text field in your list.
I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.
This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.
This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.
In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.
I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.
This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.
Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:
if (HTMLregexp.test(CellContent)) { //original pathtosharepoint line
if (NodeSet[i].parentNode.getAttribute("iid")){
var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
CellContent = CellContent.replace("SPIDReplace", SPID)
}
NodeSet[i].innerHTML = CellContent; //original pathtosharepoint line
This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010.
Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.
pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/
pathtosharepoint code: http://pathtosharepoint.com/Downloads

Resources