Skip to main content
Nintex Community Menu Bar

Investment Report Use Case - Part 2


MillaZ
Nintex Employee
Forum|alt.badge.img+21
  • Nintex Employee
  • 652 replies
Product: Kryon RPA
Product Version: Kryon 21.4
Components: Kryon Studio
Article Contributors: Artur Martirosyan
This article is the continuation of the of the previous two parts of the Investment Report Use case. In this article we will cover the Web Automation such as the usage of HTML AC, running Java Script on the page, Data Manipulation in terms of cleaning the extracted data and formatting and last but not least Excel AC/Automation inserting the extracted data to the excel sheets.
Prerequisites: For this article, the key prerequisite is to have an access to Kryon Studio. At the last stages of the development, it is recommended to have access to Kryon RPA Console and Robot to test the Wizard end to end.

Steps:

Introduction:

Todays Wizard development is mainly about the below three components:
  1. Web Automation
    • Accessing the Moneycontrol.com
    • Searching the respective Stocks
    • Getting Stock Prices
  2. Data Manipulation
    • Cleaning and formatting the extracted data
    • Concatenating the prices of all Stocks
  3. Excel Automation
    • Use of Excel AC, Working with Data Variables, mathematics, etc.
 

Web Automation:

To start the Web automation part the first thing that we need to do is to start the browser with the respective URL. for best practice, we will use an advanced command step where we will have only one command to start the web page. The reason for keeping this separate from the other steps is the exceptions and the errors that can appear while launching the website. In the case of error, the wizard can easily go back to the beginning of the step and execute it. More on the error handling and the wizard stability and resistance we will talk about in our last article of the Investment Report use case.
 

24136iBC3A50A31E564AA6.jpg

In the first part of the Investment Report  Article, we have created a set of commands which get all the files dropped to the "Ready" folder, split them per file name then get the Excel data of the current excel file. To see more details  please visit the article highlighted above:

 

24137i7A43A50B38CD8AC3.jpg

 
In step 7 of the wizard, we are using Split AC to get the next stock name to process:
 
24139i96D52ABCBA3164F4.jpg

 

Step number 8 is one of the big steps where the Wizard does most of the activities of the Web Automation, Data Manipulation, and excel activities. At first, we need to set up the default variables of the wizard.
 
24140i0F9C9DC9180D24C1.jpg
 

 

Afterwards, having the stock name from the previous steps, we use "Set HTML object value" AC to insert the stock name to the Web page and use "Click HTML" AC to click on the search button:
 
24141i24EC54F7160C678F.jpg
 
24142iAB18E1B20AB3FCA5.jpg

When working with HTML AC we can use selectors to further customize the click or insert functionalities, however in our example I have used the default settings, as it is working just fine. Additionally, there are other functionalities of the HTML ACs, such as if an error or exception happened. These items will be covered in the next/last article of the Investment Report use case.
 
After the search of the stock name, we will run JavaScript to get the current price from the page as well as we will use HTML AC to get the table data where the Volume and the Previous Close prices are stored.
To use JavaScript, the one thing to do is to get the ID, Class, Clase Name, or any other selector of the button, value, or text of the Web Page. To do that you need to click "F12" on your browser then click the highlighter button and highlight the part of the Web page on which you want to get the ID.
 
24143i0F9AB0907121C757.jpg
 

Next "Run JavaScript" on the page AC will be used with the following format. This will give us the value of the current price.

 

24144i4B2F4996AAC6DB91.jpg

 

Next HTML AC will be used to get the table data of the current stock. As there are two types of values Nse and Bse, that we are looking to extract, there we will use HTML AC to click on the Bse to get the respective values the way we did for the Nse. Once we extract all the data of the Nse and Bse tabs, then we are mostly done with the Web part, next will be cleaning and formatting, and concatenating the data.
 
24145iB0E87D1D3863C14A.jpg
 

Data Manipulation:

After extracting the data from the web, we still need to prepare the format to insert them into the excel file. For that, we will use "Get Item of the table" AC to get the respective values. These actions we will do for bot Bse and Nse prices. As throughout the development we have used row and column delimiters, the same way we use the delimiters to get the desired value from the table data.  As we know in the table data the desired values are on the 2nd and 3rd rows then we give the respective commands on the AC. this will give us the Volume and the Previous Close Price values.
 
24146iA97F2BDB2D0E190B.jpg

 

As next, we use mathematics AC to get the Price Change, the Price change is the difference between the current and previous close prices.

 

24148iED919C8E707941C3.jpg

 

 

As in many excel files, we may have multiple stock names, therefore we have to concatenate the extracted values in order to have all the values to insert them at the end. for that, we will use "Set Value" AC. What we do here is to bring all the separate prices into one variable called "AllPricesToInsert" separated by the row and the column delimeters. Once we are done with all stock names we can go to the excel insertion part.

 

24149i62F5175EBD40AB21.jpg

 

Excel Automation:

In the below block, the wizard check is there are any additional stock names, if not then it removes the additional row delimiters from the variable, uses Past Excel AC to insert all the respective data to the respective rows and move the files to the folder called "Processed".

 

24150iA067765374BDC789.jpg

 
The below screenshot is the explanation of the Past Excel AC:
 
24151i5B085582668C4CC0.jpg
 

Next, the Wizard check if there are additional excel files to process if yes then it goes to step number 6 otherwise finishes the Wizard successfully.


In our next Article, we will go deeper into error and exception handling, wizard resistance, running wizard from the console using file trigger as well as collecting logs. for any questions please ask on Nintex Community.
Translate
Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings