Skip to main content

 

Challenge Page Tutorial: Supply Chain

 

The Supply Chain Challenge page released as a part of Bot Games: Bot Wars represents a bit of a step-up in the difficulty. You have to work with multiple web applications, as well as use an XLSX to lookup data. Were you able to get a working solution? If so, great! If not, that's okay too! We're going to show you one of the approaches to solve this challenge page and discuss some other approaches that can help further improve your times. Take a look at the video above for the full challenge walk-through. We'll outline a couple of pointers below as well as some additional times for maximizing your speed if you want to see how fast you can complete the challenge. Supply Chain Challenge Page

 

Steps Package

 

If you've looked at any of our other solution tutorials, you know that we're REALLY big on using steps to frame out the major tasks that a bot must complete...then working backward a bit to go fill in the code for each step. Using steps can help developers to create logical groupings/separations in their code, as well as provide a basic "skeleton" of logic so they know exactly what actions need to be added to each section. Steps also improve the readability of your code in the case that you're working alongside other developers, or are showing the bot to business users who may not need to see every detail of the bot's operations.

 

Recorder Package

 

The Supply Chain challenge requires developers to interface with multiple web applications: the main challenge page itself + the Procurement Anywhere web app. Fortunately, using the recorder package makes handling these two different pages at the same time relatively straightforward. In fact its so easy, you may have missed exactly how Automation Anywhere is able to tell these sessions apart. It's actually driven by the Window title field that is set up when doing your recordings. The Window Title gives Automation Anywhere the details it needs to know which button/field/table you're looking to interact with, and from which exact browser window you want to use. Pro Tip: If you're using a page that has titles that are frequently updated as you navigate around a web app, consider using an asterisk (*) as a wild card in the title. This allows your bot to be bit more dynamic in the specific browser session that its looking to take action on. Changing page titles are quite common in many online market places, as well as HR apps where you might go from "Team Details - Workday" to a page that is named after a specific employee as you've clicked into their profile "Steve Rogers - Employee Details - Workday".

 

Reading From Table

 

Reading from a table is different than just reading from any normal input field. With a true HTML table, the Recorder package gives expanded options for interacting with a table, including reading the whole table, getting or searching for cell values, etc. While there are technically a few different ways to read data from a table, our tutorial above went with the approach of 'Get cell Text by Index'...which works perfectly fine for our use case of only grabbing 3 values. If we needed to read a significant amount of data from the table (more than 1 row or more than just a couple of specific values), using the Get Table action would enable us to read the data of the table to a data table variable type - where we could dynamically reference any cells/rows as needed.

 

Alternative Solutions

 

The tutorial above shows one of the most straightforward way to complete this challenge - especially for those without extensive programming/scripting backgrounds. Should you want to  explore the use of some alternate approaches to investigate their impact on processing times, there are several modifications you could try:

  1. XLSX to Dictionary
    • As an alternative to searching through the XLSX to find the state code, get the row number, and return the assigned agent, another approach would be to store the state & agent details into a Dictionary variable type. Dictionaries enable users to store key-value pairs of data...in this case, the state code would be the key (because it's the unique value) and the value would be the name of the assigned agent. This takes a bit more time upfront, but may make the logic of finding an agent's name a bit more straightforward.
  2. Use a Bot Store package
    • There are several helpful packages in Bot Store that enable developers to automate processes more quickly. One, in particular, that may be of valuable use to this exercise is the Web Automation Package. This package uses Selenium to automate web interfaces and enables developers to quickly read/modify objects on a webpage. If you're not familiar with this package - check out this helpful Bot Store spotlight video demonstrating how it can be used to solve the Customer Onboarding challenge.
  3. Browser: Run JavaScript
    • The Browser: Run JavaScript action is a great alternative to using the Recorder package as it enables developers to inject JavaScript into a page to be executed. On the downside, the action itself doesn't allow for variables to be mapped in when manually entering code. To get around this, it's suggested to pair this action with a Log to File action. Use the Log to File action to log your JavaScript code + any variables to a .js file created locally on your machine. Once created, you can then use the Browser: Run JavaScript action to execute the locally created file.

 

Conclusion

 

Part of the fun of building bots is learning about all the different ways the same problem can be solved in different ways. And while this challenge was a bit more complex than other challenges we've created - but we hope you still had a good time completing it. Explore how you may use different packages/actions to complete the challenge - noting what impact those changes have on the processing time, accuracy, and overall stability of your bot. Because all of these challenge pages are hosted in the Automation Anywhere developer portal - use these as a "playground" to try out new packages, approaches, and techniques that you can perfect, and take back to the bots you may build for your work or personal life.

Be the first to reply!

Reply