The “Health” directory is created in the server, and we have uploaded the patient
records into the server.
Now let’s assume that we are using another system and we need all the
patient details uploaded in the
server to this system. For this we can use certain activities in FTP automation
feature.
Here we are going to see if the directory and the file exists, and then download
the file to this system.
Steps to build a workflow
1. Drag and drop the “FTP” activity to the workflow. This is where we enter the
server details. We must enter the same server details from which we would
like to extract the files.
a. Double click on the activity.
b. Enter the server name, UserID and password.
2. Now, let’s see if the directory exists or not. To see if the directory is available
in the server,
a. Drag and drop a directory exists activity to the workflow.
b. Double click on the activity.
c. Specify the name of the directory within strings. Here I am going to find if the
directory “Health” exists in the server.
d. Declare a variable in the Directory exist box of the output segment, if you wish
to see the result of this activity. Eg: DE (The variable declared here is of “Boolean”
datatype.)
e. To see the result, drag and drop a writeline activity below this. Enter the variable
with the extension “.ToString”, for example: DE.ToString. We do this to convert the
“Boolean” datatype to “String” datatype as the writelibe accepts only “String”
datatype.
f. Here, we are going to drop an “If” activity below the “Directory Exists” activity.
This activity is used to make a decision. If the condition is “True”, certain set of
activities are performed, if its false, we throw a message stating that “The specified
directory does not exist”.
i. Drag and drop an “If” activity to the workflow.
ii. Specify the condition as “DE”, which is the variable in which the exist status of the
directory is stored.
iii. Specify the condition in the “If” activity as “DE”.
iv. If the condition is false, a message stating “Specified Directory does not exist” is
displayed.
3. For this, drag and drop a message box.
4. Give a message as “Specified Directory does not exist” in the input string.
5. Give a message title as “Output”.
v. If the given condition is true, which means if the directory “Health” exists, then, check
if a specific file exists in it.
vi. For that, drop a “File Exists” activity to the workflow, and enter the “Directoryname/
Filename” as the file path. Here I am going to find if the “Patient History” excel file
is available in the directory “Health”. So, we need to mention the FilePath as
“Health/Patient History.xlsx”.
g. We also mention a variable in the “FileExist” box of the output segment in which the exist
status of the file is stored. Here it is “FE”. Now, we are going to drop an “If” activity below the
“File Exists” activity. This activity is used to make a decision. If the condition is “True”, the file
is downloaded, if its “false”, we throw a message stating that “The specified file does not exist”.
6. Drag and drop an “If” activity below the “File Exists” activity.
7. Specify the condition as “FE” in which the exist status of the file is stored.
8. Now drag and drop a “Download file” activity into the Then segment of the if
activity.
9. Navigate to the property section of this activity.
a. In the “FilePath”, mention the path where the file has to be downloaded.
b. In the Ftp Filename, specify the “Directory name/File name” which has to
be downloaded.
c. In the save file name, provide a name for the file which is going to be
downloaded.
10. If the condition is false, then it throws a message stating that “ The specified file
does not exist”.
a. For this drag and drop a message box.
b. Enter the message to be displayed in the Input String.
c. Also give a message title to the display box within Strings.
11. Execute the workflow.
Click here to see how the entire workflow is built.