Skip to Content
Technical Articles
Author's profile photo Raphael Berlth

SAP Intelligent RPA: Get conditional value from Excel

Introduction

In this Blog Post I will demonstrate a possible way to get a conditional value from an excel sheet. In my example file I am searching for a specific conditional value included in a matrix:

Here a screenshot of my example file:

I would like to have the robot put the requested value into field B4 (marked in yellow).

As you can see all three guys have friends named Julia, Olga and Linea, whereas all their friends live in different cities. The value I am looking for is stated in the question “Where does John’s Friend Olga live?” In our example the correct answer would be “Warsaw” – the value of field C14.

 

Prerequisites

  • Desktop Studio 1.0.9.16
  • Microsoft Office

 

Steps

Add Excel as a new Application

Create a new workflow

Add Excel library in the project’s framework

Add an “Initialize Excel” activity in your workflow

Add an “Open Existing Excel file” activity

Add a “Start loop” activity

Add an “Exit loop” activity

Add context to your project

Add an “Exit Condition” to your “Exit Loop” activity

The condition $data$ == ‘John’ && $data$ == ‘Olga’  results in an ‘if AND’ condition. This way BOTH conditions (Name = John AND Friend = Olga) are checked if fulfilled.

Add a “Get one value” activity

Add properties to my “Get one value” activity

The row description sc.localData.Startloop + 7 lets the robot start the loop in row 7, which is the first row with values in it.

Add another “Get one value” activity

Add properties to the second “Get one value” activity

Add another “Get one value” activity

Add properties to the third “Get one value” activity

Add a “Loop” activity

Add a “Set one value” activity

This activity shows the result of requested value. I am aware of the fact that there are different ways to show the value of this newly created variable. However, I felt this way is a simple and optically valuable way to show the result.

Add properties to the “Set one value” activity

 

Result

After executing the bot, the excel file shows the value I was looking for in field B4:

 

Conclusion

The robot loops through all lines starting in line 7 and ends in line 14 as both conditions are met for the first time and saves the value related to the condition in another variable.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.