Zum Hauptinhalt springen

Iterators

Constructors​

Constructor​

new Iterators(): Iterators

Returns​

Iterators

Methods​

foreach()​

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a SystemUserIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const users = context.getSystemUsers();

// Iterate through 10 users
Iterators.foreach(users, (user, index) => {
util.out("Iterating user " + user.login + " at index " + index);
}, 10);
Parameters​
iterable​

SystemUserIterator

callback​

ForeachCallback<SystemUser>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach<TFileTypeName>(iterable, callback, count?): number

Iterate through a FileResultset.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const files = new FileResultset(fileType, filter, sortOrder);

Iterators.foreach(files, (file, index) => {
const id = file.getid();
util.out("Iterating file " + id + " at index " + index);
})
Type Parameters​
TFileTypeName​

TFileTypeName extends string | number | symbol

Parameters​
iterable​

FileResultset<TFileTypeName>

callback​

ForeachCallback<FileType<TFileTypeName>>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a AccessProfileIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const profiles = context.getAccessProfiles(false);

Iterators.foreach(profiles, (profile, index) => {
util.out("Iterating AP " + profile.name + " at index " + index);
});
Parameters​
iterable​

AccessProfileIterator

callback​

ForeachCallback<AccessProfile>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a ArchiveConnectionBlobIterator.

context.enableModules();

const blobs = xmlserver.downloadBlobs(["Unit=Default/Instance=Defaul..."], ["41D3695F2B1E11DD8A9A000C29FACDC2"]);
Iterators.foreach(blobs, (blob, index) => {
util.out("Iterating Blob " + blob.name + " at index " + index);
});
Parameters​
iterable​

ArchiveConnectionBlobIterator

callback​

ForeachCallback<ArchiveConnectionBlob>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a ArchiveFileResultset.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const files = new ArchiveFileResultset(archiveKey, filter, sortOrder, hitlist);

Iterators.foreach(files, (file, index) => {
const id = file.getArchiveKey();
util.out("Iterating file " + id + " at index " + index);
})
Parameters​
iterable​

ArchiveFileResultset

callback​

ForeachCallback<DocFile>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a ArchiveServerIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const servers = context.getArchiveServers();

Iterators.foreach(servers, (server, index) => {
util.out("Iterating server " + server.name + " at index " + index);
})
Parameters​
iterable​

ArchiveServerIterator

callback​

ForeachCallback<ArchiveServer>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a ControlFlowIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const flows = context.workflowStep.getControlFlows();

Iterators.foreach(flows, (flow, index) => {
util.out("Iterating flow " + flow.name + " at index " + index);
})
Parameters​
iterable​

ControlFlowIterator

callback​

ForeachCallback<ControlFlow>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a CustomPropertyIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const properties = context.getCustomProperties();

Iterators.foreach(properties, (property, index) => {
util.out("Iterating property " + property.name + " at index " + index);
})
Parameters​
iterable​

CustomPropertyIterator

callback​

ForeachCallback<CustomProperty>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a DocumentIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const register = context.file.getRegisterByName("Documents");
const documents = register.getDocuments();

Iterators.foreach(documents, (document, index) => {
util.out("Iterating document " + document.name + " at index " + index);
})
Parameters​
iterable​

DocumentIterator

callback​

ForeachCallback<Document>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a FolderIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const folders = context.getFoldersByName("Inv*");;

Iterators.foreach(folders, (folder, index) => {
util.out("Iterating folder " + folder.name + " at index " + index);
})
Parameters​
iterable​

FolderIterator

callback​

ForeachCallback<Folder>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a HitResultset.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const files = new HitResultset(fileType, filter, sortOrder);

Iterators.foreach(files, (file, index) => {
const id = file.getid();
util.out("Iterating file " + id + " at index " + index);
})
Parameters​
iterable​

HitResultset

callback​

ForeachCallback<DocHit>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a RegisterIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const registers = context.file.getRegisters("documents");

Iterators.foreach(registers, (register, index) => {
util.out("Iterating register " + register.name + " at index " + index);
})
Parameters​
iterable​

RegisterIterator

callback​

ForeachCallback<Register>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through a WorkflowStepIterator.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const steps = context.file.getAllLockingWorkflowSteps();

Iterators.foreach(steps, (step, index) => {
util.out("Iterating step " + step.name + " at index " + index);
})
Parameters​
iterable​

WorkflowStepIterator

callback​

ForeachCallback<WorkflowStep>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.

Call Signature​

static foreach(iterable, callback, count?): number

Iterate through the fields of a file type.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const ptpINV= new PDIterator("DlcFile", "Title='ptpInvoice'", "").first();
const field = new PDIterator(ptpINV, "to_DlcField", "");

Iterators.foreach(field, (field, index) => {
util.out("Iterating field " + step.Name + " at index " + index);
})
Parameters​
iterable​

PDIterator

callback​

ForeachCallback<PDClass>

The callback when the next entry from the iterator is fetched.

count?​

number

The count of entries to be fetched.

Returns​

number

Iterated times

Throws​

Argument iterable or callback is undefined or null.


map()​

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

SystemUserIterator

callback​

MapCallback<SystemUser, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TFileTypeName, TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TFileTypeName​

TFileTypeName extends string | number | symbol

TReturn​

TReturn

Parameters​
iterable​

FileResultset<TFileTypeName>

callback​

MapCallback<FileType<TFileTypeName>, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

AccessProfileIterator

callback​

MapCallback<AccessProfile, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveConnectionBlobIterator

callback​

MapCallback<ArchiveConnectionBlob, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveFileResultset

callback​

MapCallback<DocFile, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveServerIterator

callback​

MapCallback<ArchiveServer, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ControlFlowIterator

callback​

MapCallback<ControlFlow, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

CustomPropertyIterator

callback​

MapCallback<CustomProperty, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

DocumentIterator

callback​

MapCallback<Document, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

FolderIterator

callback​

MapCallback<Folder, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

HitResultset

callback​

MapCallback<DocHit, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

RegisterIterator

callback​

MapCallback<Register, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

SystemUserIterator

callback​

MapCallback<SystemUser, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

WorkflowStepIterator

callback​

MapCallback<WorkflowStep, TReturn>

count?​

number

Returns​

TReturn[]

Call Signature​

static map<TReturn>(iterable, callback, count?): TReturn[]

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

PDIterator

callback​

MapCallback<PDClass, TReturn>

count?​

number

Returns​

TReturn[]


reduce()​

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

SystemUserIterator

callback​

ReduceCallback<SystemUser, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TFileTypeName, TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TFileTypeName​

TFileTypeName extends string | number | symbol

TReturn​

TReturn

Parameters​
iterable​

FileResultset<TFileTypeName>

callback​

ReduceCallback<FileType<TFileTypeName>, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

AccessProfileIterator

callback​

ReduceCallback<AccessProfile, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveConnectionBlobIterator

callback​

ReduceCallback<ArchiveConnectionBlob, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveFileResultset

callback​

ReduceCallback<DocFile, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ArchiveServerIterator

callback​

ReduceCallback<ArchiveServer, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

ControlFlowIterator

callback​

ReduceCallback<ControlFlow, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

CustomPropertyIterator

callback​

ReduceCallback<CustomProperty, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

DocumentIterator

callback​

ReduceCallback<Document, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

FolderIterator

callback​

ReduceCallback<Folder, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

HitResultset

callback​

ReduceCallback<DocHit, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

RegisterIterator

callback​

ReduceCallback<Register, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

SystemUserIterator

callback​

ReduceCallback<SystemUser, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

WorkflowStepIterator

callback​

ReduceCallback<WorkflowStep, TReturn>

initialValue​

TReturn

Returns​

TReturn

Call Signature​

static reduce<TReturn>(iterable, callback, initialValue): TReturn

Type Parameters​
TReturn​

TReturn

Parameters​
iterable​

PDIterator

callback​

ReduceCallback<PDClass, TReturn>

initialValue​

TReturn

Returns​

TReturn


some()​

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

SystemUserIterator

callback​

SomeCallback<SystemUser>

Returns​

boolean

Call Signature​

static some<TFileTypeName>(iterable, callback): boolean

Type Parameters​
TFileTypeName​

TFileTypeName extends string | number | symbol

Parameters​
iterable​

FileResultset<TFileTypeName>

callback​

SomeCallback<FileType<TFileTypeName>>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

AccessProfileIterator

callback​

SomeCallback<AccessProfile>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

ArchiveConnectionBlobIterator

callback​

SomeCallback<ArchiveConnectionBlob>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

ArchiveFileResultset

callback​

SomeCallback<DocFile>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

ArchiveServerIterator

callback​

SomeCallback<ArchiveServer>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

ControlFlowIterator

callback​

SomeCallback<ControlFlow>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

CustomPropertyIterator

callback​

SomeCallback<CustomProperty>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

DocumentIterator

callback​

SomeCallback<Document>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

FolderIterator

callback​

SomeCallback<Folder>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

HitResultset

callback​

SomeCallback<DocHit>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

RegisterIterator

callback​

SomeCallback<Register>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

WorkflowStepIterator

callback​

SomeCallback<WorkflowStep>

Returns​

boolean

Call Signature​

static some(iterable, callback): boolean

Parameters​
iterable​

PDIterator

callback​

SomeCallback<PDClass>

Returns​

boolean


filter()​

Call Signature​

static filter(iterable, callback): SystemUser[]

Parameters​
iterable​

SystemUserIterator

callback​

FilterCallback<SystemUser>

Returns​

SystemUser[]

Call Signature​

static filter<TFileTypeName>(iterable, callback): DocFile[]

Type Parameters​
TFileTypeName​

TFileTypeName extends string | number | symbol

Parameters​
iterable​

FileResultset<TFileTypeName>

callback​

FilterCallback<FileType<TFileTypeName>>

Returns​

DocFile[]

Call Signature​

static filter(iterable, callback): AccessProfile[]

Parameters​
iterable​

AccessProfileIterator

callback​

FilterCallback<AccessProfile>

Returns​

AccessProfile[]

Call Signature​

static filter(iterable, callback): ArchiveConnectionBlob[]

Parameters​
iterable​

ArchiveConnectionBlobIterator

callback​

FilterCallback<ArchiveConnectionBlob>

Returns​

ArchiveConnectionBlob[]

Call Signature​

static filter(iterable, callback): DocFile[]

Parameters​
iterable​

ArchiveFileResultset

callback​

FilterCallback<DocFile>

Returns​

DocFile[]

Call Signature​

static filter(iterable, callback): ArchiveServer[]

Parameters​
iterable​

ArchiveServerIterator

callback​

FilterCallback<ArchiveServer>

Returns​

ArchiveServer[]

Call Signature​

static filter(iterable, callback): ControlFlow[]

Parameters​
iterable​

ControlFlowIterator

callback​

FilterCallback<ControlFlow>

Returns​

ControlFlow[]

Call Signature​

static filter(iterable, callback): CustomProperty[]

Parameters​
iterable​

CustomPropertyIterator

callback​

FilterCallback<CustomProperty>

Returns​

CustomProperty[]

Call Signature​

static filter(iterable, callback): Document[]

Parameters​
iterable​

DocumentIterator

callback​

FilterCallback<Document>

Returns​

Document[]

Call Signature​

static filter(iterable, callback): Folder[]

Parameters​
iterable​

FolderIterator

callback​

FilterCallback<Folder>

Returns​

Folder[]

Call Signature​

static filter(iterable, callback): DocHit[]

Parameters​
iterable​

HitResultset

callback​

FilterCallback<DocHit>

Returns​

DocHit[]

Call Signature​

static filter(iterable, callback): Register[]

Parameters​
iterable​

RegisterIterator

callback​

FilterCallback<Register>

Returns​

Register[]

Call Signature​

static filter(iterable, callback): WorkflowStep[]

Parameters​
iterable​

WorkflowStepIterator

callback​

FilterCallback<WorkflowStep>

Returns​

WorkflowStep[]

Call Signature​

static filter(iterable, callback): PDClass[]

Parameters​
iterable​

PDIterator

callback​

FilterCallback<PDClass>

Returns​

PDClass[]


foreachRegister()​

static foreachRegister(docFile, callback, options?): number

Iterate through all registers in a DocFile.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

Iterators.foreachRegister(context.file, (register, index) => {
util.log(register.name);
});

Parameters​

docFile​

DocFile

The current DocFile to iterate through register

callback​

(currentRegister, index) => void

Callback with current register and index

options?​

Provide optional options. You can select specific a register type (default all) and if check for access rights (default true)

type?​

"documents" | "fields" | "links" | "archiveddocuments" | "externalcall" | "all"

checkAccessRight?​

boolean

Returns​

number

Iterated times


foreachDocumentsInRegister()​

static foreachDocumentsInRegister(register, callback): number

Iterate through all documents in a register.

context.enableModules();
const { Iterators } = require("ou.sp.Iterators");

const register = context.file.getRegisterByName("Documents");
Iterators.foreachDocumentsInRegister(register, (document, index) => {
util.log(document.name);
})

Parameters​

register​

Register

The current register to iterate through documents

callback​

(currentItem, index) => void

Callback with current document and index

Returns​

number

Iterated times