• Познакомьтесь с пентестом веб-приложений на практике в нашем новом бесплатном курсе

    «Анализ защищенности веб-приложений»

    🔥 Записаться бесплатно!

  • CTF с учебными материалами Codeby Games

    Обучение кибербезопасности в игровой форме. Более 200 заданий по Active Directory, OSINT, PWN, Веб, Стеганографии, Реверс-инжинирингу, Форензике и Криптографии. Школа CTF с бесплатными курсами по всем категориям.

Россыпь мелких вопросов

  • Автор темы Vagor.ini
  • Дата начала
V

Vagor.ini

Тема для постинга мелких вопросов - ответов для разрботчиков приложений и баз Lotus Notes. Если Ваш вопрос влечет долгое обсуждение, то желательно создать отдельную тему.
 
V

Vagor.ini

Для юзабильностиB) форм и страниц многие разработчики создают акцию(кнопку) "Закрыть" с командой
Код:
@Command([FileCloseWindow])

Но если на форме проводилось редактирование, а потом была нажата кнопка "Закрыть" с подобной командой (подразумевающая, что сохранять не надо) лотусовский клиент все равно спросит диалогом сохранять или нет:)

Чтобы заставить команду работать без подтвержения сохранения при закрытии следует указать следующий код:
Код:
FIELD SaveOptions:="0";
@Command([FileCloseWindow])
 
G

Guest

Кстати, для справки: после присвоения SaveOptions:=0 не сохранит даже принудительный [FileSave]
 
V

Vagor.ini

Кстати, для справки: после присвоения SaveOptions:=0 не сохранит даже принудительный [FileSave]
Знаем, юзали:)

Так я же здесь и собрался такое, мелкое, постить. Будет и сложнее, буду по своим стопам:) следовать, что сам когда-то искал
 
V

Vagor.ini

Простой скрипт на выгрузку содержимого любого вида (представления) в Excel
Код:
Sub Click(Source As Button)
Dim WS As notesuiworkspace
Dim UiView As notesuiview
Dim ViewString As String
Dim session As NotesSession
Dim db As NotesDatabase 
Dim v As NotesView
Dim docX As NotesDocument
Dim col As Integer
Dim row As Double
Dim xl As Variant
Dim xlWbk As Variant
Dim pagename As String

Set WS = New notesuiworkspace
Set session = New notessession
Set db=session.CurrentDatabase

Print "Please Be Patient as the Excel Spreadsheet is being created..."

' Get dynamic view name, R5 only
' Take this part out if using in R4, you have to hard-code the name of the view in ViewString
Set UiView=WS.currentview
ViewString=UiView.viewname

Set v=db.GetView(ViewString)

' Create Excel Sheet
Set xl=CreateObject("Excel.Application")
Set xlWbk=xl.Workbooks.Add

' Add column headings to first row
col=1
Forall vColumn In v.Columns
xlWbk.ActiveSheet.Cells(1, col)=vColumn.Title
col=col+1
End Forall

' Add row data from the documents
row=2
Set docX=v.GetFirstDocument
While Not docX Is Nothing
col=1
Forall cValue In docX.ColumnValues
xlWbk.ActiveSheet.Cells(row, col)=cValue
col=col+1
End Forall
row=row+1
Set docX=v.GetNextDocument(docX)
Wend

' Make all columns fit
xlWbk.ActiveSheet.Columns.AutoFit

Print "Excel Document Successfully Created!"

' Open it up in Excel
xl.Visible=True

End Sub
 
V

Vagor.ini

Открытие вида(представления) на весь экран, без списка видов в левой части базы
Код:
@Command([ViewNavigatorsNone])

P.S. Помню как сам "пылесосил" help пока нашел команду
 
  • Нравится
Реакции: wasp
V

Vagor.ini

Удаление неиспользуемых полей базы в инспекторе дизайнера

В Lotus Designer есть одна:) неудобная штука. Если Вы удалили поле, то в списке существующих полей (инспектор, поля для столбцов вида и т.п.) все равно висит имя этого, несуществующего поля. Это, в принципе ни на что не влияет, но засоряет список. Так вот чтобы убрать это имя поля из списка следует сделать:

1. убедиться, что поле нигде не используется (формы, подформы, документы, в том числе профильные)
2. на последней справа закладке св-в БД поставить галку на "Оптимизировать таблицы документов".
3. Запустить сжатие.
 
V

Vagor.ini

Агент позволяющий удалять дублирующие записи/документы в виде
Нашел вот только, сам не тестировал.
Код:
Option Declare
Sub Initialize
%REM
DESCRIPTION:
This agent loop through documents listed in ViewDelete and marks documents that duplicates column 
values of another doc. If set it also deletes duplicates docs found in that view.

NOTES:
Design of ViewDelete:
- View should consist of at least one sorted column. To check if documents duplicate more then 
one value, the appropriate number of sorted columns should be added.
- The last column in view should be UNSORTED, and got formula which names the field marking 
duplicates (It's the best if there are no values displayed in the last column). Example 
formula: MARK_DUPLICATES
Customizing agent:
- set nameViewDelete apropriate if you want to use your own name of view
- markOnly - set true if you want agent only to set field marking duplicates, not to 
delete duplicates phisically; set false if you want to delete duplicates phisically
- doCheckMarkTags - set true if you want to preserve field names clash (agent stops if it finds
documents that already got field with name the same as field marking duplicates; set false to 
delete all documents which have fields named as field marking duplicates with value valueTagItem
- set valueTagItem if you wants to mark duplicates with another value

HISTORY:
2001-09-05, T.Zoltowski, created
%END REM
'name of search view
Const nameViewDelete = "ViewDelete"
'hard delete or just marking
Const markOnly = False
'do check if there is already a field marking duplicates on doc
Const doCheckMarkTags = True
'value marking duplicates
Const valueTagItem = "1"
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim viewDelete As NotesView
Set viewDelete = db.GetView(nameViewDelete)
If viewDelete Is Nothing Then
Print |View "| & nameViewDelete & |" not found !? Exiting.|
Exit Sub
End If
Dim numberColumns As Integer
numberColumns = Ubound(viewDelete.Columns) + 1
'check if there is apropriate number of columns
If numberColumns < 2 Then
Print |There should be at least 2 columns in view "| & nameViewDelete & |" ! Exiting.|
Exit Sub
End If
Dim columnIndex As Integer
'check if apropriate columns are sorted (it's a MUST to correctly find duplicates)
For columnIndex = 0 To numberColumns - 2
If Not viewDelete.Columns(columnIndex).IsSorted Then
Print |Column | & (columnIndex + 1) & | in view "| & nameViewDelete & |" isn't sorted (it should be!) ! Exiting.|
Exit Sub
End If
Next
'check if last column is unsorted (don't want to resort docs in view at any chance)
If viewDelete.Columns(columnIndex).IsSorted Then
Print |Last column in view "| & nameViewDelete & |" is sorted (it shouldn't be!)! Exiting.|
Exit Sub
End If
Dim nameTagItem As String
'taking the name of field marking duplicates
nameTagItem = viewDelete.Columns(columnIndex).ItemName
'actual doc 
Dim doc As NotesDocument
'doc preceding actual doc in view
Dim docPrev As NotesDocument
Set doc = viewDelete.GetFirstDocument
'are there any docs ?
If doc Is Nothing Then Exit Sub	
'do any checks
If checkMarkTags(doc, nameTagItem, doCheckMarkTags) Then
Print |Doc has item "| & nameTagItem & |" - there could be marking clash (try another name)! Exiting.|
Exit Sub
End If
Set docPrev = doc
Set doc = viewDelete.GetNextDocument(doc)
If checkMarkTags(doc, nameTagItem, doCheckMarkTags) Then
Print |Doc has item "| & nameTagItem & |" - there could be marking clash (try another name)! Exiting.|
Exit Sub
End If
Dim countProcessed As Long
countProcessed = 1
Dim countDuplicates As Long
countDuplicates = 0
Do Until doc Is Nothing
If checkMarkTags(doc, nameTagItem, doCheckMarkTags) Then
Print |Doc has item "| & nameTagItem & |" - there could be marking clash (try another name)! Exiting.|
Exit Sub
End If
Dim isDuplicate As Variant
'we assume that actual doc is "identical" as previous
isDuplicate = True
For columnIndex = 0 To numberColumns - 2
If docPrev.ColumnValues(columnIndex) <> doc.ColumnValues(columnIndex) Then
'there is a difference in column values - it's not a duplicate
 isDuplicate = False
 Exit For
End If
Next
If isDuplicate Then
'mark duplicate
Call doc.ReplaceItemValue(nameTagItem, valueTagItem)
Call doc.Save(True, True)
countDuplicates = countDuplicates + 1
End If
countProcessed = countProcessed + 1
Print "Processed " & countProcessed & ", duplicates " & countDuplicates
'move to actual doc to next doc (move previous doc too)
Set docPrev = doc
Set doc = viewDelete.GetNextDocument(doc) 
Loop
If countDuplicates > 0 Then
'we found some duplicates
If markOnly Then
'only mark - already done
Print "Finished processing document: " & countDuplicates & _
| found. Delete all docs with field "| & nameTagItem & |" set to "| & valueTagItem & |" manually.|
Else
'do hard delete
Print "Deleting duplicates"
'reference to doc being deleted (temporary)
Dim docRemove As NotesDocument
'we are moving upright starting at last doc - it preserves before sliding docs in view after 
'deleting docs and refreshing index
Set doc = viewDelete.GetLastDocument
Dim countDeleted As Long
countDeleted = 0
Do Until doc Is Nothing
'reset reference to deleted doc
 Set docRemove = Nothing
 If doc.HasItem(nameTagItem) Then
 	If doc.GetItemValue(nameTagItem)(0) = valueTagItem Then
'if it's doc marked to removing
  Set docRemove = doc
 	End If
 End If
 Set doc = viewDelete.GetPrevDocument(doc)
 If Not docRemove Is Nothing Then
'if there is doc to delete
 	Call docRemove.Remove(True)
 	countDeleted = countDeleted + 1
 	Print "Deleted " & countDeleted & " of " & countDuplicates
 End If
Loop
End If
End If
End Sub
Function checkMarkTags(doc As NotesDocument, itemName As String, doCheck As Variant) As Variant
If doCheck Then
If doc.HasItem(itemName) Then
checkMarkTags = True
Exit Function
End If
End If
checkMarkTags = False
End Function
 
V

Vagor.ini

Может кто сталкивался с подобным вопросом, подскажите пути решения.

Есть вид (view), в котором ряд колонок имеют total'ы, т.е. подбиты суммы и все это собрано в категорию и при свертке строк олучается около 100 шт. Нужно из другой базы получить total'ы категорий программно, допустим по запросу ключевой колонки (первой категоризированной в виде).

Спасибо!
 
M

mony_id

Может кто сталкивался с подобным вопросом, подскажите пути решения.

Есть вид (view), в котором ряд колонок имеют total'ы, т.е. подбиты суммы и все это собрано в категорию и при свертке строк олучается около 100 шт. Нужно из другой базы получить total'ы категорий программно, допустим по запросу ключевой колонки (первой категоризированной в виде).

Спасибо!

КАК-ТО НЕ СОВСЕМ ПОНЯНО, ЧТО БУДЕТ ЯВЛЯТЬСЯ КЛЮЧЕМ ДЛЯ ДАННЫХ ИЗ ДРУГОЙ БАЗЫ
 
M

mony_id

С ЛЕТА НЕ СКАЖУ НО НАДО ПОДУМАТЬ, ВООБЩЕТО В СКРИПТАХ ЕСТЬ ПРИМЕРЫ НЕ ПЛОХИЕ, ТАМ ГЛЯНЬ. ЕСЛИ ЧТО НИ-ТЬ НАЙДУ БРОШУ
 
M

mony_id

Vagor.ini
ДАЙ ТИПЫ ДАННЫХ И ЧТО С ЧЕМ ВЯЗАТЬ А ТО ПЛОХО ПРЕДСТАВЛЯЕТСЯ:

ВИД1
МЯСО 10
ПИВО 20
ВОДКА 30
60
 
G

Guest_VZH

Используй либо execute("@DBLookUP(...)") или объект типа NotesNavigator
 
V

Vagor.ini

mony_id
Типа вид

Name Col
-----------------------
>Полка 7
>>Шуруп 3
>>Гайка 2
>>Стяжка 2
>Стол 10
>Стул 13

30

Категория полка типа раскрыта:)

Нужно программно добраться до тотала полки=7, стол=10 и т.п
 
M

mony_id

ЗАНЕШЬ МОЖНО ПРИ ПОМОЩИ ДОКУМЕНТКОЛЕКШИОНС ПОСЧИТАТЬ СКОЛЬКО ДОКУМЕНТОВ СО ЗНАЧЕНИЕМ "ПОЛКА В ДАННОМ ВИДЕ" И НЕ ТОЛЬКО ПОСЧИТАТЬ НО И СЛОЖИТЬ ЗНАЧЕНИЯ, С ВЕРСИИ 6 ПОЯВИЛИСЬ В СКРИПТАХ МАССИВЫ.
 
V

Vagor.ini

mony_id
Колекциями я то знаю и это делаю, я имел ввиду вопрос можно ли программно получить доступ к тоталам, не персчитываю что-то отдельно. Работаю на 5 domino.

Ну в принципе я написал, работает, просто по ключу считаю (без всяких тоталов)
Код:
Sub Initialize
Dim session As NotesSession
Dim db As NotesDataBase
Dim doc As NotesDocument	

Set session = New NotesSession   
Set w = New NotesUIWorkspace 
' Для текущей базы
Set db = session.CurrentDatabase
Set doc = w.CurrentDocument 
' Для базы РВП
Set dbRVP = New NotesDatabase("mpovtsrv/mpovt/by","BASEMPOVT\RVP.nsf")
Set viewRVP = dbRVP.GetView("ExcelAllRVP")
Set docRVP = viewRVP.GetFirstDocument

Dim DSE As String
Dim TPrice As Double

Do While Not (docRVP Is Nothing)
DSE = docRVP.TAISRVPform(0)
Do While (docRVP.TAISRVPform(0)=DSE)
TPrice = TPrice + Cdbl(docRVP.Field15RVPform(0))
Set docRVP = viewRVP.GetNextDocument(docRVP)
If (docRVP Is Nothing) Then
 Exit Do
End If
Loop

Set doc = New NotesDocument(db)
doc.Form = "RVPProductForm"
doc.DCE_RVP = DSE
doc.Price_RVP = TPrice
Call doc.Save(True,False)
TPrice=0
Loop
End Sub
 
M

mony_id

Колекциями я то знаю и это делаю, я имел ввиду вопрос можно ли программно получить доступ к тоталам, не персчитываю что-то отдельно. Работаю на 5 domino.

Ну в принципе я написал, работает, просто по ключу считаю (без всяких тоталов)

КЛАДУ РУКУ НА СЕРДЦЕ НО НИЧЕГО СЕЙЧАС НЕ СКАЖУ. БОЛЬНО ГОЛОВА БОЛИТ. И Я КАК ТО БОЛЬШЕ АДМИНИСТРИРОВАНИЕМ ЗАНЯТ.

ПРОГРАММНО К ТОТАЛАМ МОЖНО ЕСЛИ ДО ЗАВТРА ТЕРПИТ ТО НАЙДУ ГДЕТО ПОПАДАЛОСЬ.

ТАМ НУЖНО ПРАВИЛЬНО ХОДИТЬ ПО СТОЛБЦАМ В ВИДЕ :)
 
M

mony_id

Естественно, подождет, найдешь пиши. Не болей

Почти выздоровил.

пока не нашел, но думаю на днях будет кусок того срипта, мы когда-то тоталы получали, что-бы их в эксель перетаскивать.


Уж чем болен Лотус так это очень слабенькими отчетами. там только своими ручками.
 
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!