Creating expressions for filters and lists in Liaison EDD

One of the more powerful features of Liaison Messenger EDD is the ability to control various actions on a conditional basis.   This ranges from sending unique email text to different recipients to creating routing preferences based on specific recipient criteria.  Various types of expressions are used to achieve the desired results.  In this article we will cover some of the most common uses of these expressions and provide examples.   This is by no means a complete list of all the possible options.   If you have a specific need our support department can assist in developing a solution.

Let’s start by defining some of the commonly used operators and functions.

= :          Equal to
== :        Used when an exact comparison of character strings is needed
<>, # :    Not equal to
$ :          Comparison, Seeks one character expression within another.
ALLT :   Removes all leading and trailing spaces
IIF :        Returns one of two values depending on the value of a logical expression
LEFT :   Returns a specified number of characters from a character expression, starting with the leftmost character.
RIGHT : Returns the specified number of rightmost characters from a character string.
INLIST : Determines whether an expression matches another expression in a set of expressions.
UPPER : Returns the specified character expression in uppercase.

FILTERING OF ACTION LINES
In some cases an action line may need to be suppressed or only executed for a specific instance.   An expression can be added under the Filtering tab of the Output section of the Script Ply Configuration.
EDD_Ply_Filter

Clicking the Edit button will open the Expression Builder.   The LMDPRS table contains the data captured from the Data Identifier Tokens (DITs) within each page of the document being processed.   The filter criteria is based on this data.  The Fields list contains each of the fields from this table.
Any field captured in the DITs can be used in a filter.   This could be reading the primary recipient preference stored in LMDCMS.DEFPREF or looking for a unique value from the document.  If stored in the user defined 1 DIT the field would be LMDPRS.USERFLD1 for instance.
In this example the filter is set to only execute this action line when the recipient ID is exactly equal to “458798”.
EDD_Expression_Builder

Additional examples
1a. Process when recipient ID is one of the following using .OR. separator and exactly equal to (==):
ALLT(LMDPRS.RECIPID)==”458798″.OR.ALLT(LMDPRS.RECIPID)==”687541″.OR.ALLT(LMDPRS.RECIPID)==”158455″
1b. When evaluating for not equal to with this method use .AND. as the separator.
ALLT(LMDPRS.RECIPID)<>”458798″.AND.ALLT(LMDPRS.RECIPID)<>”687541″.AND.ALLT(LMDPRS.RECIPID)<>”158455″

2a. Process when recipient ID is one of the following using comparison ($):
ALLT(LMDPRS.RECIPID)$”458798,687541,158455″   (separate comparison value with comma and no spaces inside quotes)
2b. This can be reversed by placing NOT ( ) or ! on front of the expression.
!ALLT(LMDPRS.RECIPID)$”458798,687541,158455″    NOT(ALLT(LMDPRS.RECIPID)$”458798,687541,158455″)

3a. Process when recipient ID is one of the following using INLIST:
INLIST(ALLT(LMDPRS.RECIPID),”458798″,”687541″,”158455″)  (values in quotes separated with comma)
3b.This can be reversed but placing NOT or ! on front of the expression.
!INLIST(ALLT(LMDPRS.RECIPID),”458798″,”687541″,”158455″)     NOT(INLIST(ALLT(LMDPRS.RECIPID),”458798″,”687541″,”158455″))

POPULATING RECIPIENT LISTS
Expressions can also be used while building recipient lists.  This can be a simple expression concatenating two fields or it can be a more involved IIF expression.  Double clicking a field on the Field Linkage tab will open the expression builder.
EDD_Field_Linkage_tab

To combine values from two fields use one of the concatenation symbols.

1. Using ‘+’ as the concatenation symbol joins the elements.  This example joins the employee first (John) and last name (Smith) separated with a space.
allt(vTWO_EDDEmployee.FRSTNAME)+” “+vTWO_EDDEmployee.LASTNAME
John Smith

2. When “-” is used it removes trailing blanks from the element preceding the operator then joins two elements.  This example joins the customer number (123456    ) with the ship to ID (ST15)
vTWO_EDDCustomer.CUSTNMBR-vTWO_EDDCustomer.SHIPTOID
Result:  123456ST15

IIF expressions can be used to return one of two values based on the result of a logical expression.  This example looks for @ in the source data field containing the email.  If more than one exists the email address is populated.  If not a static email address is entered.
IIF(ATC(“@”,Vtwo_eddcustomer.email)>1, Vtwo_eddemployee.email,”accounting@internalemail.com”)

This example sets the preference to emailed if the value is the source data field is “Email”.  If not it then looks for “Fax” and sets the preference to Faxed.  Otherwise the preference is set to Printed if the field does not contain Email or Fax. (4 is the internal value for Email, 3 for Fax, 2 for Print)
The value is forced to upper case to ensure a proper match.
IIF(UPPER(ALLT(Vtwo_eddcustomer.Userdef2))=”EMAIL”,4,IIF(UPPER(ALLT(Vtwo_eddcustomer.Userdef2))=”FAX”,3,2))

Additional functions can be found in the Expression Builder during the creation of any expression.  The Verify button will check the syntax.

These examples represent only a portion of what can be accomplished.  If you need assistance with these expressions or a more involved solution please contact us.

Click here for more information on emailing statements, invoices and many others from Dynamics AX 2012, Dynamics GP, Dynamics SL and Wennsoft.

Using XY coordinates to identify data for EDD when concatenated expressions cannot be added in a report.

Liaison EDD’s magic comes from the ability to read data from the output of a document.  The preferred method is through the Data Identifier Tokens (DITs) which are added to the report writer as calculated or formula fields. However there are certain report writers that do not allow for these expressions or fields to be added.  In these cases Liaison EDD’s XY mapping feature can provide an alternative solution for identifying the needed data.  While not as comprehensive as the DITs this method allows for all the necessary fields with room for up to 5 recipients. To get started place EDD in the Learn Mode by checking the box in System Configuration. LearnMode1

Next print your document from your source program to the Liaison Messenger EDD Primary printer.  A single page document is recommended.  A PDF will be created in the QUEUE1 folder of EDD.   When EDD polls QUEUE1 in Learn Mode you will be prompted to view the queue file for reference.  Click Yes to open the PDF. This will be helpful in determining the fields to capture.

Learn_viewQ

After the PDF is open the Learn Identifier window will appear in EDD.  This window shows the list of all fields read from the document with their corresponding XY coordinates.
Learn_Identifier

Scroll through the list to identify the fields that will be needed for routing the document. The three key fields to assign are as follows:
1. Master String – Used to identify the document type.  This should be the heading, title or other static value that is consistent on the document.
2. Document Number – Used for parsing the unique documents
3. Recipient ID 1 – Used to identify the recipient for routing purposes.

Double click a line to open the Assign Coordinate to Token Value window. Select the corresponding Token from the drop list to match the field.   For example select Document Number for the sales order number.  Once a value has been assigned the selection will be dimmed out in the list.

Learn_Assign_Value2

The Left, Top, Right and Bottom coordinates are displayed for each field.  The ‘Absolute XY Values’ represent the position of the text found on the document.  The ‘Use Max XY Values’ include the free space around the field.   The values on the Absolute line can be edited if needed.  This would be necessary for fields that can be longer than the value in the source document being used for the Learn Mode.  A good example is the recipient name.  The Right coordinate could be increased up to but not greater than the Max value.  This allows for the variable length of the name value that could appear in this position.Learn_Assign_Value

The assignment for each field will display in the DIT Assigned column. Additional fields can be captured such as the recipient name, email address, fax number and routing preference.  The unused recipient name fields can be re-purposed to capture data needed for use in the email body or as a filter criteria.  In the example below Recipient Name 5 has been used to capture the customer PO number.
The document can be assigned to be used with an existing script or a new script can be created.   When selecting an existing script choose the script from the drop list.   If creating a new script enter a Description and unique Script Alias.  Click Save when finished.  If the source PDF file is still open you will be prompted to close the file.
Learn _ID_Complete

When a new script is created the Script Editor (blue folder icon) will need to be configured. Select a Regroup Split Files By: value from the drop list.  This is used to group multi-page documents. Document ID is the most common.  Primary Recip ID can be used for documents where no document ID is available such as with statements. The Enable Script box should also be checked.
Learn_script1

At this point the action lines can be configured to control the routing of your documents.  This can include printing, emailing or faxing to a recipient, archiving a copy to a folder and printing a file copy.   The recipient list method is still used for matching the documents to the recipient’s preference.   Lists can be created from many different sources. Refer to the documentation and/or previous posts for more details.

The XY Mappings tab under the script will display the coordinates for the various fields that have been assigned.  The source PDF from QUEUE1 is moved to the LEARN folder upon completion.  This is used as the reference file and needs to stay in this folder.  At any point the Learn button can be clicked from this tab to modify any coordinates or add field assignments.

Learn_Script_XY

 

Be sure to deselect the ‘Run in Learn Mode Only’ box in System Configuration when finished.

Click here for more information on emailing statements, invoices and many others from Dynamics AX 2012, Dynamics GP, Dynamics SL and Wennsoft.