cancel
Showing results for 
Search instead for 
Did you mean: 

VB Script hook at Scan/Index - Removes All values from Currency KW's

Larry_Pantus
Champ on-the-rise
Champ on-the-rise

I wrote a VB script that is executed by the user at indexing documents using the Index Ad-hoc Hook.

This is how the VB script

Sub Main35()

Dim obapp

Set obapp = CreateObject("onbase.application")

Dim keypanel

Set keypanel = obapp.IndexKeywordPanel

Dim keywordsCol

Set keywordsCol = keypanel.Keywords

Dim keyCount

keyCount = keywordsCol.Count

Dim objKeyword


Dim invDate
Dim dueDate


For i = 0 To keyCount - 1
Set objKeyword = keywordsCol.Item(i)
Select Case objKeyword.Name
Case "Date"
invDate=objKeyword.value


Case "Vendor Terms"

Select Case objKeyword.value
Case "20 OF MONTH"
dueDate=DateAdd("m",1,invDate) 'add 1 month to inv date
dueDate=Right("0" & DatePart("m",dueDate), 2) & "/20/" & DatePart("yyyy",dueDate) 'set the day to 20th


Case "10 OF MONTH"
dueDate=DateAdd("m",1,invDate) 'add 1 month to inv date
dueDate=Right("0" & DatePart("m",dueDate), 2) & "/10/" & DatePart("yyyy",dueDate) 'set the day to 20th


Case "NET 23 DAYS"
dueDate=DateAdd("d",23,invDate) 'add 23 days to inv date


Case "NET 15"
dueDate=DateAdd("d",15,invDate) 'add 15 days to inv date


Case "NET10"
dueDate=DateAdd("d",10,invDate) 'add 10 days to inv date


Case "NET 30"
dueDate=DateAdd("d",30,invDate) 'add 30 days to inv date


Case "NET 20 DAYS"
dueDate=DateAdd("d",20,invDate) 'add 20 days to inv date


Case "NET20"
dueDate=DateAdd("d",20,invDate) 'add 20 days to inv date


Case "25 TH OF MONTH"
dueDate=DateAdd("m",1,invDate) 'add 1 month to inv date
dueDate=Right("0" & DatePart("m",dueDate), 2) & "/25/" & DatePart("yyyy",dueDate) 'set the day to 20th


Case "NET 60"
dueDate=DateAdd("d",60,invDate) 'add 60 days to inv date


Case Else
dueDate=invDate

End Select
Call keywordsCol.AddKeyword("Due Date",dueDate)'add the KW

Call keypanel.UpdateKeywordsEx(False,False)
Exit For

End Select

Next

Set keywords = Nothing

Set keypanel = Nothing

Set obapp = Nothing

End Sub

Problem is, that after the user clicks the ad-hoc button to run this script two KWs (both are currency) are getting deleted from the Index panel. user needs to re-enter them. Neither of these KWs are being modified in the script at all. The script looks at Date and determines a Due date based on KW vendor terms.

any thoughts?

3 REPLIES 3

Timothy_Cosgrif
Star Collaborator
Star Collaborator

This is a known issue in the IndexKeywordPanel in VBScripts. An SCR was created, but it was rejected. If you need this to be fixed, please contact your first line of support to have them request that the SCR be reconsidered.

This functionality does currently exist in the Unity API in OnBase 14.

Larry_Pantus
Champ on-the-rise
Champ on-the-rise

Answer accepted,

any work around? does this still apply if the script hook is executed at post index>?

Daniel_Quill
Elite Collaborator
Elite Collaborator

Larry,

1. The only workaround would be to get the document object and the keywords within the Ad-Hoc task prior to making any changes.  Then, the last thing in your script should be to re-add the currency keywords to the keyword panel.

2. This issue does occur post index as well.

 

Have a safe and happy holiday season!