Sunday, March 24, 2013

When ECM's “How” gets in the way of the “What”


It's one of those golden rules of IT projects to collect the business requirements with an open perspective, unshackled by technical or operational concerns. But, what happens when this rule is broken? What are are some of the symptoms of putting the how ahead of the what? Here are a few categories (out of many):

Over funded with small scope

Capital projects are structured in such as way as to be viable for certain period of time. These projects can have moneys which are over allocated. This creates a “bucket” to use on other, related projects, which can benefit from the “shared” software application or servers. There's a time limit, so the deadline of spending approaches, management will get creative and spend money on more innovative projects.

Project over scoped with not enough resources

This where the time-line of initiatives and ROI objectives get delayed and pushed back to the point where the original project sponsors loose faith in IT's ability to deliver. Sometimes years will go by with nothing happening, meanwhile the business is forced to find alternatives. Shadow or cloud projects are developed on the side, within the view of IT, but without consequences. That is until a system goes down and someone begs IT for help. Then IT takes it over and begins the journey back to standardization and optimization, and lest we forget, shared services.

Assumptions are not coordinated with other systems: other systems solve their own issues

The larger the IT project, the more integrated it is going to be. Without a concerted effort at understanding the full breadth of requirements and assumptions at the beginning of the project, the project will falter each time an integration step is needed. Why? Because the time and effort was not taken to include the key players of integration during the planning and funding phases of the project. The assumptions were glossed over by the deadlines to get a budget in place.

Thursday, March 7, 2013

OnBase VBScript to Export a File

Updated script: VBScript and API to export all image pages

Link to other Onbase scripts.

I spent too much time looking for a script example for exporting from OnBase the other day, so I wrote one that works within OnBase. It can be run as a script hook. The key to figuring this out was to find the table with the “file path” values in it. After rummaging around for a while I found the “itemdatapage” table which has part of the path in it. The other part (the diskgroup) has to be included in the path, plus the share drive value.

The following are the parameters that need to be set in order for the script to run correctly.

·         Database connection

o   Const CONNECTSTRING = "DSN=onbase;UID=hsi;PWD=xxxxxx"

·         Destination of copy

o   DestinationFolder = “\\\

o   DestinationFile = DestinationFolder & oDoc.Handle & ".TIF"

·         Source of file

o   FileSystemPath = Trim(oRecordSet(0)) & Trim(oRecordSet(1))

o   SourceFile =  "\\

Script Code


Test

Sub Main35()


Const CONNECTSTRING = "DSN=onbase;UID=hsi;PWD=xxxxxxx"


' Root level OnBase Automation object

  Dim oApp

  Set oApp = CreateObject("OnBase.Application")

  Dim oDoc

  Dim cKWs

  Set oDoc = oApp.CurrentDocument

  Set cKWs = oDoc.Keywords

  Dim sSQL

  Dim oRecordSet

  Dim oConn

  Dim i

  Dim FileSystemPath


 'MsgBox "oDoc.Handle:" & oDoc.Handle


  'open connection

  Set oConn = CreateObject("ADODB.Connection")

  oConn.Open CONNECTSTRING


  sSQL = "SELECT b.diskgroupname, a.filepath FROM HSI.itemdatapage a, hsi.diskgroup b WHERE itemnum =  "& oDoc.Handle &"  AND a.diskgroupnum = b.diskgroupnum"


 'MsgBox "sSQL: " & sSQL


  'Get recordset by executin query

  Set oRecordSet = CreateObject("ADODB.Recordset")

  Set oRecordSet = oConn.Execute(sSQL)


  If Not oRecordSet.EOF Then

       'MsgBox "Trim(oRecordSet(0)): " & Trim(oRecordSet(0))

       'MsgBox "Trim(oRecordSet(1)): " & Trim(oRecordSet(1))

      FileSystemPath = Trim(oRecordSet(0)) & "117" & Trim(oRecordSet(1))

  End If

 'MsgBox FileSystemPath

 ' Call oDoc.StoreKeywords()

  oRecordSet.Close

  Set oRecordSet = Nothing 

  oConn.Close


Dim DestinationFolder

DestinationFolder = "\\destination share drive\"


'MsgBox DestinationFolder


Dim DestinationFile

DestinationFile = DestinationFolder & oDoc.Handle & ".TIF"


'MsgBox DestinationFile


Dim SourceFile

SourceFile =  "\\


'MsgBox SourceFile


Set fso = CreateObject("Scripting.FileSystemObject")

    'Check to see if the file already exists in the destination folder

    If fso.FileExists(DestinationFile) Then

      'Check to see if the file is read-only

      If Not fso.GetFile(DestinationFile).Attributes And 1 Then

            'The file exists and is not read-only.  Safe to replace the file.

            fso.CopyFile SourceFile, DestinationFolder, True

      Else

            'The file exists and is read-only.

            'Remove the read-only attribute

            fso.GetFile(DestinationFile).Attributes = fso.GetFile(DestinationFile).Attributes - 1

            'Replace the file

            fso.CopyFile SourceFile, DestinationFolder, True

            'Reapply the read-only attribute

            fso.GetFile(DestinationFile).Attributes = fso.GetFile(DestinationFile).Attributes + 1

      End If

    Else

      'The file does not exist in the destination folder.  Safe to copy file to this folder.

      fso.CopyFile SourceFile, DestinationFolder, True

            'MsgBox "file copied"

    End If


Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(SourceFile)


Dim SourceCopiedFile

SourceCopiedFile = DestinationFolder & objFSO.GetFileName(objFile)


fso.MoveFile SourceCopiedFile, DestinationFile

     

Set fso = Nothing

Set objFSO = Nothing

  Set oConn = Nothing

  Set cKWs = Nothing

  Set oDoc = Nothing

  Set oApp = Nothing

End Sub 'Main35()