Can anyone shed any light on a problem I’m having with XPage Data Sources, please?
I have an XPage successfully displaying data from several associated documents in other databases using JS to access the dbs, views and docs by keys. But the user will need to edit and update certain fields, so I’m trying to use a data source and data binding. But I’m failing miserably to define a data source. Here’s the source :-
But I always get a “Could not open the document” error in the stack trace when displaying the XPage. Specifically I get
“NotesException: Invalid universal id lotus.domino.local.Database.getDocumentByUNID(Unknown Source)”
The “servername!!filename” is correct, becuase if I change it I get a database not found error.
I’ve tried it without a documentid parm but, there’s no change to the error msg. I have seen this approach used in the Lead Manager app from OpenNtf (LeadDetailsClientArea Custom Control) - I’ve no idea how it decides which document to use though.
So …
Am I correct in assuming the best way to save the data back to their original docs is using data binding.
Do you need a DocumentID parm for a data source? (Ideally this will be provided via JS looking at values within the main doc, but I’ve hard coded it above).
Subject: Re: Binding to datasource from a different database
Glad to hear you’re making progress. I agree that ‘Problems’ is not very obvious, I’ve noticed the little red cross on the design elements more times. It was mentioned at a seminar on XPages I attended, so hopefully there will be some progress in the future.
Hopefully now you’ve tracked down that it’s something to do with that database or document, you will soon be able to get it working.
You can set ignoreRequestParams to be true, in the All Properties - data - data - dominoDocument(you import)-ignoreRequestParams.Then you may find it’s ok now.
Subject: Re: Binding to datasource from a different database
Jerry
I have not tried updating a document in another database, but I am successfully binding to a datasource in another database to display data in both a View Panel and a Repeat. To do this the databaseName is just filename (in pactice I’m passing the database path as a property populated via an @DbLookup fro a config document). So I have:
compositeData.directoryView is “viwPersonByLastName”, compositedata.directoryPath is “Youngs\nPhonebook.nsf”.
If I remember rightly, when I was developing it I had big problems trying to get servername!!filename to work, which fits in with something I remember from a workshop I did, that you cannot pull data from a database on a different server yet.
Because you’re updating rather than just showing data, this may not be relevant, but hopefully it adds some more information to help get you somewhere.
Subject: Re: Binding to datasource from a different database
Thanks Paul for the thoughts. Actually the database I’m trying to access is on the same server as the XPage db. I obtained that Source from using the New DataSource dialog.
As it happens I’ve just been experimenting with accessing a different server (a production one!) and have received the usual “To open database (newserver!!otherfilename.nsf) on remote machines the server where the agent is running has to be listed by remote machine as trusted server” in the stack trace, which I similarly would receive if you ran an agent.
Subject: Re: Binding to datasource from a different database
Jerry
I’ve just tried using an XPage to open a document in another database and also tried uing an XPage to edit a document in another database. Using the datasource as you had it, with a hard-coded documentId, I had it working successfully.
It’s not something else that is triggering the problem is it? It may be worth stripping your XPage down to only one or two fields. I notice you haven’t got the computeWithForm parameter set, so that can be ruled out. Your error message also rules out document access being an issue.
One thought - do you have a default view set in your target database? I would presume that to get a document using the UNID, that will be required.
Other thn this, I can only suggest testing with different documents, a different form or a different database. That will hopefully help you track down what’s different, and so why it’s not working.
Subject: Re: Binding to datasource from a different database
Thanks Paul for your time and advice.
I’m losing the will to continue with XPages. Since Friday afternoon I’ve totally failed to get a simple View from another database displayed. And now (Sunday afternoon) I’ve tried loading your Source, amending the database and fields … and it displays absolutely nothing! I see the oneUI background but there’s nothing else on screen in the browser. Looking the HTML source there’s nowt:
-
I think I’ll reboot the server out of desperation. If that doesn’t work, my demo to management tomorrow is going to be very limited in its scope.
Subject: Re: Binding to datasource from a different database
Wally of the week award goes to me - there was a “Problem” (I wish it would bleep or flash or display a dialog box, not just list “Problems (1 items)”! I was missing a close >. So fixed that and now I get much the same error as before:- NotesException: Invalid universal id
I’ll try a different database and see if that makes a difference (I have Manager with Delete access to all dbs concerned so it’s not an access problem).
I’ve had nearly identical problems in the past. Setting ignoreRequestParam = true generally nails it as Eric mentioned, unless there are other problems.