VB Scripts

enaio® import-export 11.10 »

You can run a script after importing single or multiple records.

To do so, you can upload an existing script or paste it from the clipboard into the script area for editing.

Record scripts can change the value of the variable 'RecordInvalid' from import data to 'true' in order to define the respective record as corrupt (see Log Settings).

The variable 'strFieldValues' allows you to access the field and fixed field values of the import file within record scripts. Additional actions can be performed after importing, depending on the value content of fields and fixed fields. For example, objects can be modified or connected to other objects.

The script offers global data as follows:

Variable: arrObject

Data type: Array

Function:

Informs about all DMS objects affected by this record. The number of elements in the array is defined by the number of previously selected DMS objects. In this manner, the first array element indicates information on folder processing (usually, if the object processing order was not changed), and the second on register details (if registers are used).

Each array entry corresponds to an import objects and looks as follows:

<FolderType>#<FolderID>/<RegisterType>#<RegisterID>/<ObjectType>#<ObjectID>:<Action>

The action can contain these values:

0=no action, 1=update, 2=insert, 3=delete, 4=error

Examples:

Example 1: folder: 1#123/0#0/1#123:1

Example 2: register: 1#123/6488065#20/6488065#20:2

Example 3: document in register: 1#123/6488065#20/65537#1024:2

Example 4: document directly in folder: 1#123/0#0/65537#1024:2

Example 5: document in WF tray: 0#0/0#0/65537#1024:2

Example 6: typeless document in WF tray: 0#0/0#0/19660800#1024:2

The array with the above example details receives the following values if an imported record includes a folder, register, and document:

arrObjects(0) = 1#123/0#-1/1#123:1

arrObjects(1) = 1#123/6488065#20/6488065#20:2

arrObjects(2) = 1#123/6488065#20/65537#1024:2

 

Variable: strFieldValues

Data type: String

Function:

Field values of the record, format:

<Field1Name>="<Field1Value>";<Field2Name>="<Field2Value";<…>;

Example:

ProjectNo="1234";responsible="James Smith";image file="c:\import\file1.tif";

If a field value includes the double quote, a second double quote will be added to it in front.

 

Variable: RecordInvalid

Data type: Boolean

Function:

The return value controls whether a record should be considered as successful or corrupt (default: FALSE)

Example for a record script:

This script sets an imported document as 'archivable'.

Set server=CreateObject("OxSvrSpt.server")
Set session = server.Login("<login>", "<password>", "<ip-address>", "4000", pwNotEncrypted)
 
'Alle Objekte durchsuchen
For i=lbound(arrObjects) to ubound(arrObjects)-1
 
 sFullObjectActionInfo = arrObjects(i)
 
 'Action trennen
 vArray=split(sFullObjectActionInfo,":")
 sFullObjectInfo = vArray(0)
 sAction = vArray(1) 
 
 'Dokument trennen
 vArray=split(sFullObjectInfo ,"/")
 sObjectInfo = vArray(2)
 
 'Object ID und Typ trennen
 vArray=split(sObjectInfo ,"#")
 sObjectType = vArray(0)
 sObjectID = vArray(1)
 
 'Testen auf Objekttyp
 If sObjectType = "<object-type-id>" Then
 
  'Objekt auf archivierbar setzen
  Set job = session.NewJob("dms.XMLUpdate")
  strXML = "<DMSData><Archive><ObjectType id=""" & sObjectType &"""><Object object_id=""" & sObjectID & """></Object></ObjectType></Archive></DMSData>"
  job.InputParameters.AddNewStringParameter "XML", strXML
  job.InputParameters.AddNewIntegerParameter "Flags", 0
  job.InputParameters.AddNewStringParameter "Options", "Archivable=1"
  job.Execute
 End If
Next

'login', 'password', 'ip-address', and 'object-type-id' are configuration-specific data.