Expressions

This Help topic refers to the following editions:
þ
Enterprise þ Professional þ Personal þ Small Business
.

 

Expressions are a powerful way to customize the workflow definition. You can use expressions in several properties of some blocks, specially in task definition properties of a task block. When the property is about to be used, all expressions in the text are converted to their values. Expressions are identified by brackets "[" and "]". Below are examples of expression usage:

 

Subject: This is a subject about order number [OrderNo].

Description: Please mr. [UserName], solve this task until date [DateToStr(StartDate + 30)].

 

In these examples we have three expressions: OrderNo, UserName and DateToStr(StartDate + 30). Note that expressions use workflow variables. The value of the workflow variable is evaluated and used in the expression. As an example, the result text, after evaluating the expressions, would be:

 

Subject: This is a subject about order number 1042.

Description: Please mr. Smith, solve this task until date 12-05-2007.

 

Besides workflow variables, expressions also accept:

 

aritmetic operators

+, -, /, *, div, mod

 

boolean/logical operators

and, or, not, xor

 

relational operators

<>, =, <, >, <=, >=

 

bitwise operators

shl, shr

 

numeric constants

153 (integer), 152.43 (decimal), $AA (hexa)

 

string constants

'This is a text'

 

char constants

#13 (return character)

 

Built In Variables

_User.UserName: Represents the name of the user currently logged in

_User.Email: Represents the e-mail address for the user current logged in.

 

Workflow Functions

The following function can only be used within scripts blocks in the workflow designer.

 

MoveAttachments(_Workflow, CabinetName, DrawerName, FolderName: string);

This method moves the attached document in a workflow to the specified Cabinet, Drawer, Folder. If the location does not exist if will be created for you.

 

UpdateWorkflowVariables(WorkflowName: string; FieldValues: String);

This method updates an existing workflow variable for new workflows to access when created

 

UpdateTaskField(_Workflow : TWorkflowDiagram; TaskBlockName: String; TaskName: String; FieldName: String; Value: string);

This method updates an existing workflow lookup field values

 

GetIndexValues(_Workflow : TWorkflowDiagram);

Retrieves index set values associated with the first document attachment

 

SetIndexValues(_Workflow : TWorkflowDiagram);

Assigns the workflow values associated with all the document attachments

 

GetScriptValue(const AText: string);

Use this function to obtain a scripting variable that is defined at runtime like AI name value pairs. Assign the name of the runtime variable the AText parameter.

 

General Purpose Functions

The following function can be used in scripts blocks within the workflow designer and any other location where scripting is supported.

 

GetExternalLookupValue(DataSourceName: string;KeyFieldsValues: string, ResultField: string): string;

This method returns a value from an external data source. The data source definition as defined in the help under "External Data Lookup List Editor"

DataSourceName: This represents the user defined name when the data source definition created

KeyFieldsValues: Is a list of name value pairs use define your criteria of the document to locate.

ResultField:  This represents the field name you would like the value of

 

This sample script locates the data in a column call "Subject" that has the value "Test subject name" and return the value in the "Document Date" field.

None of the values are cases sensitive

GetExternalLookupValue('MyDataSourceName', 'Subject', 'My documents subject', 'Document Date');

 

GetInternalLookupValue(CabinetName: string; IndexSetName: string; KeyFieldsValues: string; ResultField: string): string;

This method locates the first document that matches the criteria defined by KeyFieldsValues; a name value pairs delimited by a commas.

e.g. "Subject=My document name,Document Date=10/23/2025,Document Type=Invoice"

Cabinet Name: represents the user defined cabinet name where the document is located.

IndexSetName: represents the user defined Index sets name used by the document.

KeyFieldsValues: Is a list of name value pairs use define your criteria of the document to locate.

ResultField:This represents a Index Set field name you would like the value of

 

This sample script locates a document in the cabinet "My Cabinet". "Subject=Test subject name"  this locates the document with the subject field containing the text "Test document subject" and return the value in the "Document Date" and "Document Type" fields.

None of the values are cases sensitive

var

  ReturnValue: string;

begin

  // this script locate a document in the Cabinet "My Cabinet" with the subject equaling the word "test" and return the value of the "Document Date" field

  ReturnValue :=  GetInternalLookupValue('My Cabinet', 'Subject=test subject name', 'Document Date');

end;

 

FindDocument(_Workflow: TWorkflowObject,  Command: string): variant;

This function executes the Saved Search Attachment associated with the workflow along with a parameter that defines an additional command

_Workflow: Enter the text "_Workflow" for this value

Command: The following is a list of Commands that can be execute on the documents that had been located

1. "Data" : This returns a table of data in a comma delimited format representing the documents that were located

2. "RecordCount": This returns the number of document that were located

3. "Delete": This Deletes the documents that were located

 

FindDocumentEx(FindCriteria: string, Command: string): variant;

This function executes the API  command [FindDocument] and executes an additional Command on the result

FindCriteria: This parameter represents the text command based on the API command [FindDocument] (see Developers API Instructions)

Command: The following is a list of Commands that can be execute on the documents that had been located

1. "TableData" : This returns a table of data in a comma delimited format representing the documents that were located. Use the GetTable... methods below to retrieve any value in the TableData

2. "RecordCount": This returns the number of document that were located

3. "Delete": This Deletes the documents that were located

 

DeleteFolder(Cabinet, Drawer, Folder: string; UserRecycelBin, DisableEventLogging, RaiseException: boolean);

This method deletes a folder and its sub folders located in the Library tree.

Cabinet: Enter the name of the cabinet surrounded in single quotes, which the folder is located.

Drawer:  Enter the name of the drawer surrounded in single quotes, which the folder is located

Folder:  Enter the name of the folder surrounded in single quotes, that should be removed. The Folder parameter can support sub-folders .e.g. "folder1\folder2\etc.."

UserRecycelBin: Set this parameter to True or False if the deleted documents should be moved to the Library's Recycle Bin.

DisableEventLogging: Set this parameter to True or False if you wish to disable user event logs from tracking this process

RaiseException: Set this parameter to True or False if an exception should be raised if the process fails.

 

ShowValue(Data: string; IncludeHeader: boolean);

This method displays a dialog representing the TableData or pure text

TableData : If the data represents Table Data in .csv formated text retrieved from functions like FindDocument, FindDocumentEx, and AI Capture processing and text information

IncludeHeader: Set this parameter to True or False if the first row of data defined the names of the data in the subsequent rows. If the data is from the AI capture process, set this parameter to false.

 

GetTableValueByFieldName(TableData: stringg; TableFieldName: string; TableRow: Integer): string;

This function retrieves a value based on a index field name and row from a table stored in a comma separated value format e.g(.cvs).  

TableData: This represents a .csv formated text retrieved from the functions FindDocument, FindDocumentEx, and AI Capture process

TableFieldName: enter the column name for the value you want to retrieve

TableRow: enter the row number for the value you want to retrieve

 

GetTableValueByColRow(TableData: string; TableColoumn: Integer; TableRow: Integer): string;

This function retrieves a value based on a column and row number from a table stored in a comma separated value format e.g(.cvs).  

TableData: This represents a .csv formated text retrieved from the functions FindDocument, FindDocumentEx, and AI Capture process

TableColoumn: enter the column number for the value you want to retrieve

TableRow: enter the row number for the value you want to retrieve

 

GetTableRowCount(TableData: string): Integer;

This function is used to obtain the total number of rows that exist in a table data stored in a comma separated value format e.g(.cvs). Us this function when loop through each column of data in a table.

TableData: This represents a .csv formated text retrieved from the functions FindDocument, FindDocumentEx, and AI Capture process

 

GetTableColumnCount(TableData: string): Integer;

This function is used to obtain the total number of columns that exist in a table data stored in a comma separated value format e.g(.cvs). Us this function when loop through each column of data in a table.

TableData: This represents a .csv formated text retrieved from the functions FindDocument, FindDocumentEx, and AI Capture process

 

This sample script shows all row and columns of information from a csv table.

var

  i,j: Integer;

begin

 //the first row hold the column headers so we start on row 2

 for i:=2 to GetTableRowCount(TableData) do          

   //show each columns information

   for j:=1 to GetTableColumnCount(TableData) do                                                        

     ShowMessage(GetTableValuByColrRow(TableData,j,i));

end;

 

SaveTextToFile(FileName:string; Data:string);

This method is used to save any text value to file.

FileName: is the full Drive:\Path\AndFileName to be save to any local or network drive.

 

LoadTextToFile(FileName:string): Text;

This function is used to retrieve any text value from a file and assign it to a local variable.

FileName: is the full Drive:\Path\AndFileName to load from any local or network drive.

 

SendCommand(<_User.UserName>,<DX API command>);

SendCommand can send any API command to any computer that is running Docuxplorer. Enter the Docuxplorer user account name that is currently run Docuxplorer and the command will be executed on their computer. One example would be running an import jobs on one computer to centralize the processing. You can not use a computers name only a Docuxplorer user account name.

As a test, use the SendCommand to displays a popup message on the computer the Docuxplorer Administrator is running. The /n place in the text to indicate that a carriage return is required so the message can span multiple lines.

e.g. SendCommand( 'ADMINISTRATOR' , '[ShowPopupMessage]' + #13#10 + 'Message=Your message /n here.' );

 

ContainsText(const AText, ASubText: string): Boolean;

Performs a case insensitive search for substring ASubText in string AText. Returns true if one or more instances of ASubText exist in AText.

 

StringReplace(const Source: string, OldPattern, NewPattern string):string;

This function substitutes one set of characters for another found in the Source String

 

CurrToStr(Value Currency):string;

The function converts a currency Value into a displayable string. The decimal point and digits are only displayed if non-zero. The CurrencyDecimals does not affect this function. Unexpectedly, there is no currency symbol or thousands separator character used in the display.

 

StripCharSet(const Source: string; CharSet: TSysCharSet):string;

The function removes the values in the CharSet from the Source String

 

StripNonAlpha(const Source: string):string;

The function removes the none Alpha characters from the Source String

 

StripNonNumeric(const Source: string):string;

The function removes the none Numeric characters from the Source String

 

StripNonAlphaNumeric(const Source: string):string;

The function removes the none Alpha and Numeric characters from the Source String

 

StripNonDate(const Source: string):string;

The function removes Alpha that are not normally found in dates from the Source String

 

RegExFirstMatchValue(const Pattern, Source: string): string;

The function find the first occurrence of text defined by the regular expression text patterns from the Source String. Use the site https://regex101.com/ to create and validate your regular expressions.

 

RegExAllMatchValues(const Pattern, Source: string): string;

The function find all of the occurrence of text defined by the regular expression text patterns from the Source String. Use the site https://regex101.com/ to create and validate your regular expressions.

 

RegExGetGroupValue(const Pattern, Source: string; IndexItem: Integer): string;

The function finds the defined group (IndexItem) of text defined by the regular expression text patterns from the Source String. Use the site https://regex101.com/ to create and validate your regular expressions.

 

SoundexSimilar(const AText, AOther: string; ALength: TSoundexLength): Boolean;

Indicates whether two strings are similar. SoundexSimilar returns true if the string specified by AText is "similar" to the string specified by AOther, or false if the two strings are not sufficiently similar. SoundexSimilar uses a Soundex algorithm to convert both strings into a phonetic representation where each character of the resulting string represents one of six families of similar phonemes. It then compares up to ALength digits in the resulting representation, returning true if they are all the same and false if they are not.

 

ReplaceTime(var DateTime: TDateTime; Hours, Minutes, Seconds: word);

Replaces the time portion of a TDateTime value with a specified time. ReplaceTime changes the value of the DateTime parameter so that it has the same time as the New Time parameter (Hours, Minutes, Seconds) as defined in 24 hour clock. The date portion of DateTime remains the same.

 

DaysBetween(const ANow, AThen: TDateTime): Integer;

Returns the number of whole days between two specified TDateTime values. Call DaysBetween to obtain the difference, in days, between two TDateTime values. DaysBetween counts only whole days. Thus, DaysBetween reports the difference between Dec 31, 1999 11:59 P.M. and Jan 1, 2000 11:58 P.M. as 0, because the difference is one minute short of an entire day. DaysBetween always returns a positive result and therefore the parameter values are interchangeable.

 

AdjustToBuisnessDay(Date: TDatetime): TDatetime;

This function adjusts the date value to the next business work day.

e.g. AdjustToBuisnessDay(Today) this omits Sat and Sun as work days for the current date

 

AdjustToBuisnessDayHours(Date: TDatetime): TDatetime;

This function adjusts the date and time value to the next business work day and hours of operation.

e.g. AdjustToBuisnessDayTime(Today) this omits Sat and Sun as work days for the current date and hours between 8:00Am and 6:00 PM

 

StartOfTheMonth(Date: TDatetime): TDatetime;

This function adjusts the date value to the first day of the month.

 

EndOfTheMonth(Date: TDatetime): TDatetime;

This function adjusts the date value to the last day of the month.

 

ExportAttachments(_Workflow : TWorkflowDiagram, SendToOptions: Integer);

Exports Attachments via the SendToOption to the operating system temp folder

0: Export in the original file format

1: Exports a document to the temp folder in the original file format

2: Exports a link file with the extension of .dx

3: Exports a hyperlink file with the extension of .html

4: unsupported

5: unsupported

6: unsupported

7: unsupported

8: unsupported

9: Return the raw URL of the document

 

DeleteWorkflowHistory(_Workflow : TWorkflowDiagram; RetentionPeriod : Integer);

This method deletes completed workflows that are less than the Retention Period (n number of months);

e.g. Retention Period 24, 12/1/2023 - 24 = 12/1/2022

 

Delphi Pascal like functions and procedures

Abs

AnsiCompareStr

AnsiCompareText

AnsiLowerCase

AnsiUpperCase

Append

ArcTan

Assigned

AssignFile

Beep

Chdir

Chr

CloseFile

CompareStr

CompareText

Copy

Cos

CreateOleObject

Date

DateTimeToStr

DateToStr

DayOfWeek

Dec

DecodeDate

DecodeTime

Delete

EncodeDate

EncodeTime

EOF

Exp

FilePos

FileSize

FloatToStr

Format

FormatDateTime

FormatFloat

Frac

GetActiveOleObject

High

Inc

IncDay

IncMonth

InputQuery

Insert

Int

IntToHex

IntToStr

IsLeapYear

IsValidIdent

Length

Ln

Low

LowerCase

Now

Odd

Ord

Pos

Raise

Random

ReadLn

Reset

Rewrite

Round

ShowMessage

Sin

Sqr

Sqrt

StrToDate

StrToDateTime

StrToFloat

StrToInt

StrToIntDef

StrToTime

Time

TimeToStr

Trim

TrimLeft

TrimRight

Trunc

UpperCase

VarArrayCreate

VarArrayHighBound

VarArrayLowBound

VarIsNull

VarToStr

Write

WriteLn