0

These are the steps I am taking -

  1. Create a new document and fill in a few fields
  2. Save the document
  3. Click the copy button which I inserted as action bar (asks how many copies to make)
  4. The document is then duplicated X amount of times

I am trying to carry over certain fields from the original document that I copied to minimize data entry. I am new to Lotus Notes Formula also.

The code I have so far for the copy action bar button:

num := @Prompt([OkCancelList]; "Choose amount"; "How many copies?"; "3"; "1":"2":"3":"4");

@For(n := 1; n <= @TextToNumber(num); n := n + 1; @PostedCommand([Compose]; ""; "Form1");  @PostedCommand([FileSave]))

The document copies itself with no problem but the fields remain empty. I have tried using @SetField but I think something is wrong while in the loop?

Any help is much appreciated.

1 Answer 1

1

First of all: This IS possible, but with formula language it will be very awkward.

You need to collect the information from your current context first:

_tempSubject := Subject;
_num := @Prompt([OkCancelList]; "Choose amount"; "How many copies?"; "3"; "1":"2":"3":"4");
@For(n := 1; n <= @TextToNumber(_num); n := n + 1; 
  @Command([Compose]; ""; "Form1");  
  @UpdateFormulaContext;
  FIELD Subject := _tempSubject;
  @PostedCommand([FileSave]))

You could also write @SetField( "Subject"; _tempSubject ) if you like that more than the FIELD- statement, it does exactly the same (unless you use Notes 5 or older where it made a difference, 15 years ago)

This really is a task for using LotusScript, that is much more flexible.

5
  • Thanks for the answer. Would you please explain what _anotherValue is for and the FIELD statements? The fields I want to copy are named: 'Subject' for example and both documents contain the same field name.
    – n00bAdmin
    Jul 10, 2015 at 10:30
  • _anotherValue is a variable name ( I always use underscore to identify them as variables, to distinguish them from fields). And FIELD is another annotation of @SetField... I changed the example accordingly...
    – Tode
    Jul 10, 2015 at 12:53
  • Thanks for the help! The code looks great, and I understand each line. I tried running this formula but it's not copying over the data from Subject field to the newly created document. It creates as many duplicates as I specify, but keeping the fields empty. Any ideas?
    – n00bAdmin
    Jul 10, 2015 at 13:08
  • sorry, I did not take care... Replace @PostedCommand([Compose]; ""; "Form1"); with @Command([Compose]; ""; "Form1"); as @PostedCommand only comes AFTER all other code is done...
    – Tode
    Jul 10, 2015 at 13:20
  • That works much better! Thanks. Now the only thing is when I make 3 copies from a saved document, it creates 3 copies and only saving the last document while the first 2 stay in edit mode. can this be fixed as well.
    – n00bAdmin
    Jul 10, 2015 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .