XPages: Erratic access to a 3rd database - xpages

I have a db, I'll call it db X, that contains all the XPages programming that accesses data in dbs A and B. This is only used for web access, not in a Notes client. One primary XPage in db X displays data from db A in a view (viewA) on one tab, and from db B (viewB) in another. This works great! However, when I click on a doc in viewA, it opens in another XPage just fine, and has a filtered version of viewB that is supposed to show just the docs from db B relevant to the current doc from db A. But it is completely empty. If I remove the filter, it should display all docs in db B, but is still empty. I've verified that the data source for viewB is identical on both XPages. Note that db A and db B are on the same server, and are even in the same folder. Db X is on the same server as the other 2, but in a different folder (above the other 2).
Any ideas why viewB works in one XPage and not the other?

For your "embedded view" data source (viewB in docA) set the ignoreRequestParams property for the Domino view data source to true to ensure the view data source does not use the document ID that was present in the URL.
ADDITIONAL DETAILS: In a two-page application involving a "view" XPage and a "document" XPage, when the application user clicks a link on the view page to open the document on the document page the ID for the document to open is passed with the REQUEST parameters. You can see this in the resulting URL for the document page which will have the ID for the document to open appended to the URL address, for example &documentId=49530CA58D17CCE5852575150069D857&action=openDocument. This works perfectly when the document page has only one Domino document data source. However, in the embedded view application the "document" XPage will also include a data source for the xe:dataView. When ignoreRequestParams is NOT true for the Domino view data source (and for any other additional data sources on the page) then the parameters passed in the request ARE evaluated to determine which view entries to display in the xe:dataView. These request parameters point to a UNID that is not the desired data source for the view so no view entries are displayed.

Related

Kentico page update not update Physical table

I Have Kentico web site which has scheduler task that synchronise data with external Database. Basically few pages created from external database table. We have two methods for both create and update record in Kentico table.
For create we use
TreeNode page = TreeNode.New(Helper.ClassName_Campus);
page.SetValue("Title", "Title");
page.Insert(parentPage);
Create record works fine and update physical table data.
For update we use
TreeNode page = DocumentHelper.GetDocuments(Helper.ClassName_Campus).OnSite("site").Where(" ID", QueryOperator.Equals, 1).FirstObject;
page.SetValue("Title", "Title");
page.Update();
Update method does works OK. when i go to page and form data i can see new data on the form field, but it doesn't update actual physical table data. How can we update the actual physical data table when updating page. where is Kentico store form data after update.
This is the link we found on kentico web site for update table data.
https://docs.kentico.com/display/K9/Working+with+pages+in+the+API
Kentico content tables (the ones bound to a page type) always contain only published data. In case you are using workflow/versioning the "new" data will be stored in CMS_VersionHistory table instead.
The solution is simply to publish the page by using something like:
var page = DocumentHelper.GetDocument(1, new TreeProvider());
page.DocumentName = "Update name";
page.Publish();
Did you use workflow for this pages?
You can try to using DocumentHelper.UpdateDocument(...) and specify there a TreeProvider, because maybe you don't have permission to update this page.
Here's the link to API how manage the page

How to format link in email to open an Xpage App

I am sending out an HTML email to our users every week in which I want to include links to certain documents and then a link to the overall database. The database is an Xpage db.
On my docs I have a field only visible to me in which I compute the link I need. The format is as follows:
notes://servername/__.nsf/0/?OpenDocument
What I want is the URL to open not just a specific document, but the Xpages app in general. Everything I try opens up the all documents view.
notes://servername/__.nsf/
If I put this in the address bar, it works fine. If I put it in a link, it goes to the all documents view.
Any help would be greatly appreciated.
You could try formatting it as: notes://servername/__.nsf/nameOfXpageYouWantToOpenTo.xsp?OpenXPage
Have you set the launch properties for the database? You can specify a designated XPage in there too.
The format you are looking for is:
notes://servername/yourdb.nsf/someview/unid?OpenDocument
in the "someview" view you add a form formula to point to an empty form that has the property set "open XPage instead" - careful there are 2 of them: for web and client.
If you don't use native forms and the Xpage is always the same, then you can skip the step with the form formula and the extra form and edit the properties of the existing form.
Paul's solution should work too.
Use this code syntax to open any XPage in the Notes client:
#URLOpen("notes://Host/Path/Database.nsf/XPageName.xsp?OpenXPage")
Additional details:
And use the following to open a specific document in the XPage where unid is the unique document identifier for the document:
#URLOpen("notes://Host/Path/Database.nsf/XPageName.xsp?documentId=unid&action=openDocument")

Get recently read document in Lotus Notes Database

I am developing a database on Lotus Designer 8.5 environment with LotusScript and LotusFormula.
Is there any possibilities on get a list of recently opened documents (for example last five) in a Lotus Notes database ? My purpose is to provide an embedded view showing the recent documents opened by current user on the current database, which will act like some kind of history view.
Please advise
Use a folder categorized by username. Add the current document in PostOpen event to folder with document.PutInFolder(folderName) and remove the oldest document from folder with document.RemoveFromFolder(folderName)
This way you don't need to edit the documents and can show the last visited documents for a user in an embedded view.
As an alternative you can use user specific folders with option "Shared, private on first use".
I have that functionality in one of my databases.
I just added some code in the QueryOpen event of the form to store the UNID of the document in a profile document linked to the specific user. The values are stored in a multi value field, and my code removes the oldest entry when the number of entries I want to store is exceeded.
The user can actually set that number themselves in teh applications settings, 5 is default but they can make it more or less.
I built a class for this, makes it very easy to modify later, and to implement it in different forms, for different document types.
I then built a method to expose the last documents to the user, using a dropdown box as you can see below. Since you only wwant/need the five (or perhas ten) last documents, no need to use a view.

Not able to filter data from view for public access user

I need to access and filter data from an nsf file for which I made the access public as per instructions : XPages Public Access Support
I am accessing this database from another database.
When I put the view on an xpage whithout filtering the data , everything works fine.
The anonymous user can see the view all the data.
Once I start filtering the data of the view , I get a message : "Notes error: You are not authorized to perform that operation"
The filtering is correct since , when I log into the database , and refresh the xpage , all data is filtered and displayed correctly.
EDIT
When I filter the view data with "Filter by column value" , the xpage seems to work.
It doesn't work when I filter the data with "Search in view results"
What can I do ?
As far as I know are users with public access not allowed to perform full text searches. I don't believe that this restriction can be overridden.
EDIT:
You need at least reader access to perform a search in a view.

Filtering a nested repeat

My application has documents for Companies, and for Clients. This is a many to many relationship; a company can have any number of clients, and a client can be a client of many companies. The relationships are stored by creating a response document to the company, with a field containing the ID of the client document.
I would like to be able to show fields from the client document on the company's XPage, and I've been trying to do this with repeat controls. I created a view of all the link documents, and used that to create a repeat, filtering it with the current document ID to collect all the links that the current company has. This allows me to list all the IDs of the client documents associated with that company.
I have been trying to work out how to pass this ID to a repeat control nested within the first one, either to use it as a filter on a view of all the client documents, or to use it as the data source document ID directly. Is this possible? If not, how would I go about showing data from the client document on the company page?
When you specify a repeat control you specify the variable that contains the instance value. This variable name is visible to anything inside the repeat control. So your variable would contain the UNID of the client documents one at a time. E.g you call it ClientDocID. You put a panel inside that repeat control. That panel can have its own DominoDocument data source. The datasource can have new, display or edit as default action. You pick "display" which requires a DocumentId to be provided. Select "computed" and simply use ClientDocID as formula.
You can suppress rendering of HTML for the panel (check the properties), so it would fit e.g. inside a xp:tr.
Hope that helps

Resources