[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2753
  • Last Modified:

@Command([OpenView])

Ok, i have 2 databases, Database A and B

Database A is filled with documents that have files attached to them

What i want to do is, the user press a button in database B and that will open a document in database A. I have played around with some code and i can get it to work, but it only opens the first or the last selected document.
@Command([ToolsRunMacro];"OpenExport");
@Command([FileOpenDatabase]; "Server":"DIR\\database.nsf"; "myVew";"DocumentInView" ;"1"; "1" )
@Command([EditDocument];"1");
@Command([EditGotoField];"vAttachment");
@Command([EditSelectAll]);
@Command([AttachmentLaunch]);
@Command([EditDocument];"0");
@Command( [FileCloseWindow]);
@Command( [FileCloseWindow])
 
I have also tried
 
@Command([ToolsRunMacro];"OpenExport");
@Command([FileOpenDatabase]; "Server":"DIR\\database.nsf"; "";"" ;"1"; "1" )
@Command([OpenView];"myVew";""DocumentInView");
@Command([OpenDocument]; "1")

Open in new window

0
DrTrollrot
Asked:
DrTrollrot
  • 4
  • 4
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
Is there any relation between the documents in A and B? How do you know what document you want to open in A?

Apparently you don't want to open the document, but you intend to launch the attachment in there. There are better ways to get that done. How many attachments are there in the document?
0
 
DrTrollrotAuthor Commented:
By the button in Database B i control what document i want to open in Database A (a lot of buttons in the end :)

This is why i tried ..
@Command([FileOpenDatabase]; "Server":"DIR\\database.nsf"; "myVew";"OpenDocumentInView" ;"1"; "1" )

And back to your question, only the attached file in the specified document is important, and it will only be one attached file in each document.

I have successfully done this but only if there is one document in Database A, when i add more it stops to work.
0
 
Sjef BosmanGroupware ConsultantCommented:
Okay, so there's no relation? Or do you have 10 buttons, each numbered from 1 to 10 or so, and when the user clicks button 5 you want the 5th document to be opened? You'd better get the IDs of those documents through a DbColumn or DbLookup, so you can directly address the right document.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
DrTrollrotAuthor Commented:
Database B
Action Button "Technical Manual"
Code if it worked with more than one docment.
@Command([FileOpenDatabase]; "MyServer":"docdatabase.nsf"; "Technical";"TechManual" ;"1"; "1" )

@Command([EditDocument];"1");
@Command([EditGotoField];"vAttachment");
@Command([EditSelectAll]);
@Command([AttachmentLaunch]);

So explained ... This launch docdatabase.nsf, it will go to the view "Technical" and it should select the document "TechManual" in Database A. It will then open the document in edit mode, go to the attachment field, select it and launch it.

The relation should be the file i specifed in the Action Button compared to the name of the document in the first column in Database A.

So if i write Cheese in the action it will open database A, go to the specified view and look for the document "cheese" and open it.
0
 
mbonaciCommented:
I think it's more appropriate to use LotusScript here...
0
 
DrTrollrotAuthor Commented:
I solved it my self, the first column in Database A must be sorted

Working code
On Button Call
@Command([FileOpenDatabase]; "YourServer":"YourDatabase.nsf"; "YourView";"YourDoc" ;"1"; "1" );
@Command([EditDocument];"1");
@Command([EditGotoField];"vAttachment");
@Command([EditSelectAll]);
@Command([AttachmentLaunch]);
@Command([EditDocument];"0");
@Command( [FileCloseWindow]);
@Command( [FileCloseWindow])
0
 
Sjef BosmanGroupware ConsultantCommented:
Forget the code you use, you're on the wrong track. It can be done in Formula, but NOT by opening views etc. It even think that Formula is easier, for I wouldn't know how to launch the application for the attachment from LotusScript. Must be doable, I think...

Anyway, you can locate a document in a different database using @DbLookup. You can then open that document and start the attachment.

It is also possible to start the first attachment by using a different form. The form's launch properties should be set to "Start the first attachment"
0
 
Sjef BosmanGroupware ConsultantCommented:
Well... sorted, yes, of course... I assumed the view was sorted...

IMHO the code is still not very elegant, and I doubt it is fool-proof. For instance, your code won't work if someone doesn't have editor rights on the document.

You're too fast in closing the question...
0
 
DrTrollrotAuthor Commented:
True, it wont work if the user dont have edit rights nor will any error message pop-up if the user dosent have the software installed to open the attached file. But as for the moment the solution above will be sufficient.

I might add that if you place the code directly under a Action Bar button you will get an error, the solution for that is to put the code in a agent and call it by @Command([ToolsRunMacro];"YourAgent");
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now