Syntax Guide

Overview

This page provides descriptions (and in some cases examples) of the syntax for functions, methods, objects and properties available in various ScanToPDF plugins. The available syntax will be displayed in a small pop-up window in the software when an open curly brace is entered in any setting where a syntax is available. Figure 1 illustrates the pop up window and shows the syntax and a brief description of that syntax. In this document the syntax is listed in alphabetical order

Capitalise Function
Purpose

return a capitalized version of an input string

Syntax

{Capitalise(input)}

Example (Automatic file namer output file path setting)

{Capitalise(“scantopdf”)}

Result = SCANTOPDF

Concatenate Function
Purpose

Concatenate 2 strings together into 1 output

Syntax

{Concatenate(string 1, string 2)}

Example

C:\PDF Files\{Concatenate(“Invoice”,GetBarcodeText())}.pdf

Date Function
Purpose

Provides a date in a specified format

Syntax

{Date():format specifier}

Examples

{Date():dd-MM-yyyy} Result=01-01-2016 (1st January 2016)
{Date():hh-mm} Result = 10:15
{Date():ddd} Result = Thu
{Date():dddd} Result = Thursday

Extract Function
Purpose

Returns an extracted substring from a given input using delimiter and index

Syntax

{Extract(input,delimiter,index)}

Example

{Extract(“FIELD1-FIELD2-FIELD3″,”-“,3)}

Result = FIELD3

GetFilenameWithoutExtension
Purpose

Returns the file name of a given file path without the file extension

Syntax

{GetFilenameWithoutExtension(filepath)}

Example (in the Error case name generation in the Automatic file namer plugin)

C:\PDF Files\Errors\{GetFilenameWithoutExtension(ImportFilePath)}.pdf

This would save the file using the name of the imported source file

GetFilePathWithUniqueVersion Function
Purpose

Returns a unique file path with a formatted version suffix

Syntax

{GetFilePathWithUniqueVersion(string filepath, string format, boolean useOriginal, integer startIndex}

filepath – a string to represent the path of the output file
format – a string to represent the format to use for the version number
useOriginal – a boolean set to true to use just the name for the first version, set to false to use the name and version
startIndex – an integer to represent the number to use for the first version (1 by default)

Example 1 (in the “Output file path” setting of the Automatic file namer plugin)

{GetFilePathWithUniqueVersion(“C:\PDF Files\doc.pdf”,”_{0:000}”, true,1)}

Results in file names as follows

“C:\PDF Files\doc.pdf” – no version number
“C:\PDF Files\doc_001.pdf” – version 1
“C:\PDF Files\doc_002.pdf” – version 2

Example 2 (in the “Output file path” setting of the Automatic file namer plugin)

{GetFilePathWithUniqueVersion(“C:\PDF Files\”+ GetBarcodeText()+”.pdf”,”_{0:000}”,true,1)}

Would use the barcode value for the file name, and then create new versions if the same barcode was recognised again, for example if the barcode value was TMC7200

Results in file names as follows:

“C:\PDF Files\TMC7200.pdf” – no version number
“C:\PDF Files\TMC7200_001.pdf” – version 1
“C:\PDF Files\TMC7200_002.pdf” – version 2

GetWeekOfYear Function
Purpose

Returns the week number corresponding to a date

Syntax

{GetWeekOfYear(Date)}

Example

{GetWeekOfYear(Date())}

Result = Integer representing the current week number of the current year

IsNull Function
Purpose

Returns true if a variable is null

Syntax

IsNull(variable)

Example (used in the “Condition” setting of the Document Indexing plugin

IsNull(invoiceNumber)

RemoveChars Function
Purpose

Removes chars defined as ASCII codes (single or comma separated list) and returns result

Syntax

{RemoveChars(string input,asciiCodes)}

Example 1

{RemoveChars(“HELLO WORLD”,32)}

Example 2

{RemoveChars(“HELLO WORLD”,’ ‘)}

Result = “HELLOWORLD”

NOTE : ASCII CODE DECIMAL 32 IS THE SPACE CHARACTER

RemoveExtraSpaces Function
Purpose

Removes trailing and leading spaces and sequences of 2 or more spaces from an input string

Syntax

{RemoveExtraSpaces(string input)}

Example

{RemoveExtraSpaces(” HELLO WORLD “)}

Result = “HELLO WORLD”

RemoveSpaces Function
Purpose

Returns a string stripped of all spaces from a string input

Syntax

{RemoveSpaces(string input)}

Example

{RemoveSpaces(“HELLO WORLD”)}

Output = “HELLOWORLD”

Replace Function
Purpose

Replace an old value in a given string with a new value

Syntax

{Replace(string input, string old-value, string new-value)}

Example

{Replace(GetBarcodeText(),”SO”,”SALES-ORDER”)}

Input=SO-12345
Result=SALES-ORDER-12345

SubString Function
Purpose

Retrieves a substring from a given string. The substring starts at a specified character position and has a specified length.

Syntax

SubString(string, startindex, length)

Parameters

string – the string to be processed
startindex – the starting position of the substring (zero based)
length – the length of the substring

Example

C:\PDF Files\{SubString(GetBarcodeText(),0,3)}.pdf

would return the first 3 characters of a barcode

Ternary Function
Purpose

Returns a string from choices decided by conditions. Var1 is returned for the true condition. Var2 is returned for a false condition.

Syntax

Ternary(Boolean condition, String var1, String var2)

Example

{Ternary(docType=”INV”,”INV” + invoiceNumber,”PO” + poNumber)}

Improved in version 5.1.2.14

extended Ternary syntax:

Ternary(condition1, value1, [condition2], [value2], …, [elseValue])

each condition is tested sequentially

Example

{Ternary(docType=”INV”,”INV” + invoiceNumber,docType=”PO”,”PO” + poNumber)}

Translate Function
Purpose

Returns a translated input string where all found elements in list1 have been replaced by their corresponding element in list2. The lists are separated by the pipe ‘|’ character.

Syntax

{Translate(String input, String list1, String list2)}

Example

{Translate(docType,”SO|PO|INV”,”Sales Order|Purchase Order|Invoice”)}

SO would become Sales Order

PO would become Purchase Order

INV would become Invoice

TranslateUsingCSVFile
Purpose

Returns a translated input string from a CSV file.

Syntax

{TranslateUsingCSVFile(Object input, String csv file path, Object default, Boolean skip 1st line, Integer search column, Integer result column)}

Example

{TranslateUsingCSVFile(alpha,”c:\oic\translate.csv”,”NOT FOUND”,true,1,2)}

This syntax would translate the variable called alpha into a new value using the 1st column of the CSV file c:\oic\translate.csv as the search column, returning the value in column 2 as the result. If the search was un-successful the return value would be NOT FOUND. The CSV file has column headers in the 1st line so the 1st line is skipped (setting the Boolean skip 1st line to True)

ValueMatchesRegex Function
Purpose

Returns true if input matches regex pattern

Syntax

{ValueMatchesRegex(String input, String Regex)}

Example (used in the “Condition” setting of the document indexing plugin

{ValueMatchesRegex(GetBarcodeText(),”INVOICE”)}

Would display the document indexing window if the barcode value was INVOICE

Pin It on Pinterest