0

We have a bunch of databases with similar designs. All of them have some design elements which inherit from various templates. Many of them have a specific view that needs that needs to be updated, but is not marked to inherit from a template.

While I know that I could remove the view from the databases, I'm not sure how I would add just that view from my template to each of the databases without doing it manually.

How would I copy a design element from one database to another programmatically?

3 Answers 3

3

I'm not sure why you cannot just mark also these views to inherit from template. Anyway Views are also notes and you should be able to copy a view this way:

lotus.domino.Database db = session.getCurrentDatabase();
db.getDocumentByUNID(db.getView("myview").getUniversalID()).copyToDatabase(dbTarget);
5
  • The reason not to just mark them to inherit is that there are 65 databases and, while I could go and mark each to inherit, that would pretty time-consuming, especially if I decide there are multiple design elements that I want to be copied. Jan 18, 2013 at 14:24
  • I picked this as the answer, because it looks like I could use this for any design element, not just the view. Jan 18, 2013 at 14:29
  • @DavidNavarre You could write a piece of code to mark the design elements to inherit from template in all those databases. Jan 18, 2013 at 14:48
  • Panu, is it as simple as setting the "fromtemplate" value as seen via DXL editing? Jan 22, 2013 at 21:54
  • @DavidNavarre It probably works that way too. I've used NoteCollection. The template name is in $Class item. Jan 23, 2013 at 7:49
2

You can not copy the NotesView directly. But you can do it by DXLExporter and DXLImporter. This is just complex and waste of time.

We have one alternate way for doing this. Instead of copying the view. We can copy the viewColumn and Create a new view in all other databases. Paste these column into it.

Set notesViewColumn = notesView.CopyColumn( sourceColumn [ , destinationIndex& ] )
1
  • I love this solution. However, I put the check-mark on Panu's answer because I think it could be used for multiple design elements, rather than just views. Thanks, Ramkumar! Jan 18, 2013 at 14:30
0

I know that it does not answer exactly your questions but i wanted to suggest a Different approach.

You can have the view in the template and in all databases. Then you could add an Option in a Profile to enable or disable the view. In the outline you can hide or Display the view depending on the Profile setting.

2
  • Interesting solution, but the issue is getting the view into the already existing 65 databases in the first place. The current view contains 7 or 8 columns (depending on the database) and I want only 3, one of which is not among the existing columns. Jan 18, 2013 at 14:27
  • Yes, got it. Thanks for the feedback. Have a great week end :-) Jan 18, 2013 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.