Steps:
Introduction:
Todays Wizard development is mainly about the below three components:- Web Automation
- Accessing the Moneycontrol.com
- Searching the respective Stocks
- Getting Stock Prices
- Data Manipulation
- Cleaning and formatting the extracted data
- Concatenating the prices of all Stocks
- 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.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:




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.
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.

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

Data Manipulation:

As next, we use mathematics AC to get the Price Change, the Price change is the difference between the current and previous close prices.
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.
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".

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.