Все документы сайта

ttavi's
web site


на главную
поиск
все документы

темы

Фотографии
Lotus Domino

сервисы

Гостевая
Блог

статус

1238 documents
size:
528.11Mb
last update:
05/05/2012
about database



Rambler's Top100

external


lotusflame



ApacheC9DC6CFABA3E4F26C3256B7C0049D4D20
CSS3511CEE09EF162B2C3256AFF004596B30
CV & Portfolio6EAAA3C8656F2A55C3256CD100552B5A0
English, TOEFL1E16C1BAF1AA7CACC3256B04004952350
favicon91E9E700CA269A88C3256B720029386B0
Finland9A7764576635B1E6C3256C990034788A0
Food & Decoration8AB81F227382EDD0C3256BB80030D9570
GoogleMapsAPI523E475BFDE196EDC325760F0039DFAC0
Hardware8272DEE3AC15AC48C3256BDD003665FE0
Hardware\Epox8RDA+DEE4A109AE891A90C3256E22002E64A90
Hardware\MVP3VIB PC Partner05C5A48920032B9BC3256E22002E32920
Hardware\ShuttleHot57189D4C1E51A2E3571C3256E22002DACFD0
Hardware\WacomVolito3DEC2C4996F9546EC3256E22002E11C20
HTML3976D6FA6CAF0324C3256C750046638C0
JavascriptB4D4E5BE64B531E1C3256B43004CCAFB0
Joomla and VirtueMart77C63502670C7CDAC325720F0055393E0
Lotus Domino53E497D65DC6D36BC3256B44002A10530
Macromedia FlashDFAF3E10E78308E0C3256B41003A6F2C0
MnogosearchB495895DC6ED901BC3256BA3004AB58E0
Perl7FEE6B42FA3EA75BC3256B7C004948030
PHP79889F4A141BBC00C3256B800030F8BD0
Rich Text FormatAFF177BBCB35181AC3256B06004A0B590
SQLAF329532750136FCC3256B7B0049A2940
WAPA1A23016F56997E7C3256BC200426A940
WordPress4DA6284BD5667FFE442579C70042427D0
xml1361832D17EB431AC3256B170027482B0
АвтоECC4A07CEA67AD28C3256C1A0037E3300
Базы данных5B4581C8CA04BD35C3256B0C002958A50
Вечерние рисовальные классыAF7A347328F599F5C3256E5A0028CF110
Воздушные змеи928CAACFBC05BEBDC3256B9C0027259B0
Деньги2B662F7104A8E809C3256E120054F2500
Иран75EA73D7685FA707C3257449003DB7090
Карты и достопримечательности7C434181DBE63903C3256D52003D2D290
Книги, текстыC86D23BD7FE174F0C3256B900028FB730
Коммунальные службы5D6B90410CF077A1C3256CAF003517310
Мобильные телефоны13131C678323E784C3256BDC003CD8200
Мобильные телефоны\SonyEriccsonK700iFCC0B316F1D99D11C3256ED100227D480
Настройка компьютера6717A9AE2D24F890C32578D90047D8110
ОБЖ и БЖД062E5D0F36AC6089C32574E90022BCE60
Обработка аудио и видео9A310A7A1CAAE213C3256CBF004081BE0
Обучение525BE674AB67F25BC3256B8100492D020
Пенсионная реформа71A0576E6183A90FC3256DEC003138870
Праздники0A3D70DDFFEED598C3256C7F0029AF230
Принтеры89B41673067A4449C3256B730035BF5B0
Раскрутка сайтов0A689E9A8A30C1C4C3256B3D004241E40
Ребенки7C85980A8707166CC3256E20003551E40
РукоделиеF9F6C2FAA5942560C3256C41003B52870
СсылкиF94F9B26C97C86D5C3256DB00048ED0F0
Танцы259418322C309E5CC3256CF6003F14380
Техзадания8BC4D4DF1873AC8BC3256B99003A9F3C0
Фотографии и иллюстрации1F76576479B24735C3256DE40028BAAD0
Фотографии и иллюстрации\DadoFDB055DAAA9E9D8BC3256E36003E34B90
Фотографии и иллюстрации\DesignersBD1FDA12B93A298BC3256C64002C116B0
Фотографии и иллюстрации\Designers\2advanced2DC6ACB06B44C3C3C3256C62002F5BE80
Фотографии и иллюстрации\Designers\erwinolafBB2C9310170AD34CC3256D2F004B41190
Фотографии и иллюстрации\Designers\Luetke4EC0FFA2CA5BD04CC3256C6F00291AF00
Фотографии и иллюстрации\Designers\Merkulka66D5AC8268FF9004C3256D7B002AA7FE0
Фотографии и иллюстрации\Designers\MiscellanyA53D0DC886CDCC17C3256E1B0027AEAF0
Фотографии и иллюстрации\Designers\Munch39636BC70D44EAEEC3256C5C003A47990
Фотографии и иллюстрации\Designers\Nadar0292B85277F8131DC3256DE4002ACFFB0
Фотографии и иллюстрации\Designers\RodchenkoEA4BBEC11BAEAD51C3256C71004CCBD80
Фотографии и иллюстрации\Designers\SamohvalovC8B037BAE7BBE9C0C3256C770047426E0
Фотографии и иллюстрации\Designers\ShemyakinC7AB5E5B53895A2DC3256CF4004301790
Фотографии и иллюстрации\Designers\ВрубельACC0D12847145304C3256C5D002CEB3C0
Фотографии и иллюстрации\Designers\Миу-мау37C73CDE079F5046C3256C590027CD010
Фотографии и иллюстрации\Designers\Олег ПащенкоD69DCF81821D6CB5C3256C590027B4A10
Фотографии и иллюстрации\Designers\Скабичевский8F8C07ECC79302F6C3256C590027E8350
Фотографии и иллюстрации\Designers\Эл Казовский9E247160768F0249C3256C590027F97B0
Фотографии и иллюстрации\Designers\Эрте/Роман ТыртовBCF2C9E47BDDE78DC3256C590027D7750
Фотографии и иллюстрации\Мост & Питерская КАД2649E23C8F31B21FC3256E6E004037020
Шрифты и дизайн293E779FF651D842C3256B02002858A40

Created 06/04 02:29 PM Modified 06/07 03:51 PM
Напишите комментарий к этому документу, мне будет приятно

    
Go to folder:  

>>> Examples: Agents




1. This LotusScript code writes a value to the Category field based on the value of the TotalSales field of each document in the database. Compare with Examples 2 and 3, which use Java and formula solutions. The script example requires more lines of code than the formula solution but includes the algorithm for finding the documents being processed.

    Sub Initialize
        Dim session As New NotesSession
        Dim db As NotesDatabase
        Dim dc As NotesDocumentCollection
        Dim doc As NotesDocument
        Set db = session.CurrentDatabase
        Set dc = db.AllDocuments
        Set doc = dc.GetFirstDocument
        While Not(doc Is Nothing)
             category = doc.Category
             totalSales = doc.TotalSales
             Select Case totalSales(0)
             Case Is >= 200000 : category(0) = "Above Quota"
             Case Is >= 100000 : category(0) = "OK"
             Case Else : category(0) = "Below Quota"
             End Select
             doc.Category = category
             Call doc.Save(True, False)
             Set doc = dc.GetNextDocument(doc)
        Wend
    End Sub

2. This Java agent writes a value to the Category field based on the value of the TotalSales field of each document in the database. Compare with Examples 1 and 3, which use LotusScript and formula solutions. As with LotusScript, the Java code includes the algorithm for finding the documents being processed.

    import lotus.domino.*;

    public class JavaAgent extends AgentBase {

      public void NotesMain() {

        try {
         Session session = getSession();
         AgentContext agentContext = session.getAgentContext();

          // (Your code goes here)
         Database db = agentContext.getCurrentDatabase();
         DocumentCollection dc = db.getAllDocuments();
         Document doc = dc.getFirstDocument();
         while (doc != null) {
           double totalSales = doc.getItemValueDouble("TotalSales");
           if (totalSales >= 200000)
             doc.replaceItemValue("Category", "Above quota");
           else if (totalSales >= 100000)
             doc.replaceItemValue("Category", "OK");
           else
             doc.replaceItemValue("Category", "Below quota");
           doc.save(true, false);
           doc = dc.getNextDocument();
           }

        } catch(Exception e) {
         e.printStackTrace();
       }
     }
    }


3. This formula writes a value to the Category field based on the value of the TotalSales field of each document in the database, assuming that all documents are selected for processing. Compare with Examples 1 and 2, which use LotusScript and Java solutions. The formula executes once on each document selected by combining outside criteria with the SELECT statement. Data declarations are implicit and formula syntax is cryptic making for compact source code.

    FIELD Category := @If(TotalSales >= 200000; "Above Quota"; TotalSales >= 100000; "OK"; "Below Quota");
    SELECT @All

4. This formula writes a value to the Category of selected documents based on the value of the TotalSales field. The SELECT statement, if it is not SELECT @All, must precede the statements in the formula that it applies to.

    SELECT TotalSales >= 200000;
    FIELD Category := "Above Quota"

5. This LotusScript code finds the sum of all OrderTotal fields in a database for one day, and writes a new record to the database containing the daily total. Each record in the database has OrderNumber, Date, and OrderTotal fields. The script finds all the documents in the database, then uses a loop and a comparison of dates to limit processing to today's documents. For each document, the script adds the OrderTotal to a dailyTotal variable. The script places the words "DAILY TOTAL" in the OrderNumber field for the document that it writes, and places the dailyTotal value in the OrderTotal field.

    Sub Initialize
        Dim session As New NotesSession
        Dim db As NotesDatabase
        Dim dc As NotesDocumentCollection
        Dim doc As NotesDocument
        Dim dateDate As New NotesDateTime("")
        Dim dateToday As New NotesDateTime("Today")
        Set db = session.CurrentDatabase
        Set dc = db.AllDocuments
        dailyTotal = 0
        Set doc = dc.GetFirstDocument
        While Not(doc Is Nothing)
             odate = doc.Date
             dn = Datenumber(Year(odate(0)), _
             Month(odate(0)), Day(odate(0)))
             orderNumber = doc.OrderNumber
             If dn = Today _
             And orderNumber(0) <> "DAILY TOTAL" Then
                  orderTotal = doc.OrderTotal
                  dailyTotal = dailyTotal + orderTotal(0)
             End If
             Set doc = dc.GetNextDocument(doc)
        Wend
        Dim docNew As New NotesDocument(db)
        Set itm = _
        docNew.AppendItemValue("OrderNumber", "DAILY TOTAL")
        Set itm = _
        docNew.AppendItemValue("OrderTotal", dailyTotal)
        Set itm = _
        docNew.AppendItemValue("Date", Date$)
        Call docNew.Save(True, False)
    End Sub

See Also

Glossary
Feedback on Help or Product Usability?