varAI := @dblookup on 2,000 docs from db2
REM{ Code run on db1 via action button: };
@For(n := 1;
n <= @Elements(varAI) ;
n := n + 1;
@Command([Compose];“IR”) ;
@UpdateFormulaContext ;
FIELD IRAI := varAI[n] ;
@If(@Command([FileSave]);@Command([FileCloseWindow]);“”)
);
What I’m doing with this is for every document in database 2 I’m creating new documents in database 1 and populating a field in the new document from the dblookup in database 2. Why does the above code keep creating documents before saving & closing the current document? Everything is returning the proper values but as you could imagine once the document count in db2 really gets up there it bombs because of all the document windows open in db1 at the same time while its creating them. When it works (only if I lower the document count in db2) it creates all the documents, sets the field values then saves/closes them all in that order? What it should do (or at least what Im trying to get it to do) is create a document, set the field value, save it close it, then go to the next document. I realize this can all be done in lotusscript on the backend but for the sake of an exercise, how do I get it to save/close before continuing the loop in formula?