Step 5 Create Processing Sequence

LANSA Composer

Step 5. Create Processing Sequence

LIC009 - Handle multiple requests via an email attachment

In this step you will create a processing sequence to do the following:

  • Assign a variable = OK
  • While variable = OK
  • Retrieve single email using MAIL_RECEIVE
  • If FROMADDRESS is not equal to blank (an email was found)

           -  Loop through email attachment file (list)

           -  CONCAT path and filename create output path\filename

           -  Transform from file PSLMST to XML, selecting EMPNO form email attachment file

           -  FTP XML file to remote host

     Else

           -  Variable = END – ends While loop next time through

           -  Terminate

1.  In the Navigator, select Definitions, Processing sequences

2.  Use the button on the toolbar to create a new Processing Sequence.

3.  Select Palette tab from the left panel, then drag Assign and drop it on the Details panel on the right side.

4.  In the Expression input field of the Assign operation, type in
&FLAG_WHILE = 'OK'

5.  From the left panel Palette tab, drag the While operation and drop it at the end of the sequence.
In the Condition field, type &FLAG_WHILE = 'OK'

6.  From the left panel Activities tab, drag the MAIL_RECEIVE activity and drop it at the end of the sequence.
Use Promote / Demote buttons if necessary to position the activity inside the While loop.

7.  Complete the POP3CONFIG parameters of the MAIL_RECEIVE activity by dragging the iii_TUTPOP3 from the Configurations tab on the left panel or you can simply type it in.

8.  From the Palette tab, drag and drop an If at the end of the sequence. Make sure it is inside the While loop.

9.  From the Variables tab, drag FROMADDRESS and drop it in the IF Condition field, then complete the condition by typing *NE '' (two single quotes, no space)

     Note: The FROMADDRESS will be blank when no e-mail is received. You will use this condition to change the loop flag later on to end the loop.

     When the IF condition is true, then you will loop through the e-mail attachments (in case more than one attachment is received) and send the attachment to the transformation map, and FTP out the result.

10. From the Palette tab, drag the LOOP directive and drop it at the end of the processing sequence. It must be inside the IF condition block.

11. Fill in the LOOP fields by dragging and dropping ATTACHMENTLIST from the Variables tab, and by typing the other fields.

12. Drag the CONCAT activity from the Activities tab and drop it at the end of the sequence. It must be inside the LOOP block. Use the Promote/Demote buttons to correct the level if necessary.

     You will use this activity to build the file name of the Response XML file as follows:

STRING 1

File path

'/Lansa_Composer_licpgmlib/lic/Tutorial/iiiFTPOUT'

STRING 2

File Name

'/iiiEmployeeDetails'

STRING 3

Attachment Count

&ATLOOPINDEX

STRING 4

File Type

'.xml'

STRINGOUT

ResultString

&RESPONSEFILENAME

 

 

13. From the left panel Transformations tab, drag iiiTUTMAP03 and drop it at the end of the sequence. It must be inside the LOOP block. Use Promote/Demote to correct the level if necessary.

14. Fill in the Transform Inbound parameters by drag and drop from the Variables tab or typing:

15. After the transformation has run, the processing sequence will use FTP to send the output XML file.
Drag FTP_OUTBOUND activity from the Activities tab on the left panel. Set FTPCONFIG parameter to iiiTUTFTPOUT by drag and drop from Configurations tab or by typing.

     Your sequence will look like this:

16. From the Palette tab, drag Else and drop it at the end of the sequence. It must be at the same level as the IF block.

17. The ELSE block will be reached when there is no further e-mail to process. Here you will add the logic to end the While block.

     From the Palette tab, drag Assign and drop it at the end of the sequence. It must be inside the else block.

     Type the assignment expression: &FLAG_WHILE = 'END'

     This will end the loop in the next iteration when the While condition is evaluated.

18. From the Palette tab, drag Terminate and drop it at the end of the sequence. Use the Promote button to shift the Terminate to the top level.

     Your completed sequence should look like the following:

19. Save your processing sequence as:

Name:

iiiTUTSEQ07

Description:

Handle employee list CSV request  – LIC009.

Status:

Active