Newbie on Lotus Script needs guideline on agent creating few documents and fill in some data

Any help is appreciated:

I need to compute the average cost/ produciton by category, where by documents are created by different category. This will need to be done on monthly basis.

I plan to create a button, once click, it will automatically compose form UnitProductionCost, fill in the field category, refresh and save, than, create another document with another category.

In this example, I have 3 different categories: apple, orange and pineapple.

anyone has a useful code that he / she can share? Would really appreciates that.

Tqvm.

Subject: Newbie on Lotus Script needs guideline on agent creating few documents and fill in some data

Hi Will

Here is a starting point for you … (you can get a lot of this from the Designer Help database by the way). You’ll need to modify this to suit your purposes.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument



Set db = session.CurrentDatabase



'case Apple

Set doc = db.CreateDocument()

doc.form = "YourFromName"

doc.CategoryName = "Apple"

'add any other data to the document here using the format

' doc.<FieldNameHere> = <Correct datatype here>   'of course do not use < and > symbols

'...

Call doc.ComputeWithForm(True,True) ' Computes the form's formulae

Call doc.Save(True, False)



'case Orange & Pineapple

'same as above but change the category to Orange

End Sub

Good luck

B

http://www.Internet-Marketing-Wizards

Subject: RE: Newbie on Lotus Script needs guideline on agent creating few documents and fill in some data

Tq, Bizhan, I will explore that. I wasn’t able to properly learn how to use lotus script, so I probably just learn from sample codes. Cause I don’t quite understand the principle, hopefully I would have the opportunity to really learn about it one day.

Subject: RE: Newbie on Lotus Script needs guideline on agent creating few documents and fill in some data

Will

Check out the Domino designer help db. There is a simple step by step tutorial to get you started.

Also there are lots & lots of free tutorials on various aspects of Lotus Script in this website (see Training on the left menu) and elsewhere. This and several other sites also have some great webcasts that you can see in your own time & pace. They are extremely helpful.

Check them out and you’ll soon be writing your own scripts.

Good luck

B

http://www.Internet-Marketing-Wizards.com

Subject: What book will you recommend on lotus script? (eom)

Subject: RE: What book will you recommend on lotus script? (eom)

Hi Will

I learnt LotusScript many years ago and the books of that time are not relevant. Since then Domino has changed a lot of course.

When I was learning there was no online help like there is today. So my recommendation is to do a search for Domino and LotusScript on the web and see which of the results provide info the way it suits you.

I suggest you make a start with the designer help which is easy to understand. Then there are the “IBM Redbooks” which you can find and download on this web site. They are very good and comprehensive on all aspects of Domino including scripting.

You can checkout places like:

www.dominopower.com

www.searchdomino.com

There are many more such sites that send you tips and also have online tutorials.

Even just the turorials, tips and webcasts on this website will move you along quickly and very easily.

But my top recommendation is this company … they have excellent courses and you will learn interactively and quickly. Some years ago I think IBM licensed their material. And I too bought some of their courses back in the 90s:

Enjoy & Good luck

B

http://www.Internet-Marketing-Wizards.com

Subject: RE: What book will you recommend on lotus script? (eom)

the book I learned it from was the “60 Minute Guide to LotusScript”. It is very old, probably out of print, you may have hard time finding it. But its a good one. Still relevant, as the stuff in there is all still in LS and all still very necessary.

Failing that, I would say go to the ReplaceItemValue method of the NotesDocument class and go to the example in the Help file. ALWAYS look at the examples for the different methods and properties. They give you a little sample code to use and understand. Then look at the stuff in the NotesSession class. You can learn it that way, no problem. The good thing is that LS is so easy, once you get the hang of a little bit of it, the rest is really really the same.