Power Search Activity

Bronze Certified

Custom Activity

0 reviews

1

Power Search Activity

Bronze Certified

Custom Activity

0 reviews

1


Summary

This activity checks if values are present in a DataTable. It returns a Boolean and multiple dictionaries. A boolean variable is True when all values are present and if not, the following dictionaries are created: Present Values, Missing Values, Rest Values.

carouselImage0

Overview

How does it work?

You have to provide two objects:
a) a DataTable in which you have to find values
b) Dictionary with key as String (column name) and value as an array of strings (values which you are looking for)

As a result you can obtain the following output dictionaries:
a) Present dictionary – contains columns with the names and values you were looking for – the matched values.
b) Missing dictionary – contains the names of the columns and values which are missing.
c) Leftovers dictionary – contains the names of the columns and rest values except those which were missing or you were looking for.
d) Find confirmation dictionary – contains the names of columns and True or False values – True when all values from the array were found and False if any of it were missing.

Example:
DT:
Numbers, Cities, Countries, Elements
23, Szczecin, Poland, Iron
8987, Berlin, Germany, Polon
34, Prague, Czech, Hydrogen
231, New York, USA, Oxygen
11, Moscow, Russia, Mercury
1515, Shanghai, China, Chlorine
125, Tokyo, Japan, Iridium

Here are the data which we are looking for:
Numbers: 23, 34, 11
Cities: Berlin, Tokyo
Elements: Mercury, Iron, Oxygen


Here is how our query dictionary is looking like:
Dictionary<string, string[]>(3) { { "Numbers", string[3] { "23", "34", "11" } }, { "Cities", string[2] { "Berlin", "Tokyo" } }, { "Elements", string[3] { "Mercury", "Iron", "oxygen" } } }

And here are our results:

a) Present dictionary (Present_dictionary)
Dictionary<string, string[]>(3) { { "Numbers", string[3] { "23", "34", "11" } }, { "Cities", string[2] { "Berlin", "Tokyo" } }, { "Elements", string[3] { "Mercury", "Iron", "Oxygen" } } }

b) Missing dictionary (Missing_dictionary)
Dictionary<string, string[]>(3) { { "Numbers", string[0] { } }, { "Cities", string[0] { } }, { "Elements", string[0] { } } }

c) Leftovers dictionary (Leftover_dictionary)
Dictionary<string, string[]>(3) { { "Numbers", string[4] { "8987", "231", "1515", "125" } }, { "Cities", string[5] { "Szczecin", "Prague", "New York", "Moscow", "Shanghai" } }, { "Elements", string[4] { "Polon", "Hydrogen", "Chlorine", "iridium" } } }

d) Find confirmation dictionary (Found_dictionary)
Dictionary<string, bool>(3) { { "Numbers", true }, { "Cities", true }, { "Elements", true } }
If we would modify our query with some values which are not in table:
Dictionary<string, string[]>(3) { { "Numbers", string[3] { "23", "34", "16" } }, { "Cities", string[2] { "Warsaw", "Tokyo" } }, { "Elements", string[3] { "Mercury", "Iron", "Oxygen" } } }

Then in b and c, we will get:
B’) Dictionary<string, string[]>(3) { { "Numbers", string[1] { "16" } }, { "Cities", string[1] { "Warsaw" } }, { "Elements", string[0] { } } }
C’) Dictionary<string, bool>(3) { { "Numbers", false }, { "Cities", false }, { "Elements", true } }


The step by step manual is available in the documentation in "Powersearch - one-page manual how to use"

Benefits


Published: 19 Jan 2021 | Updated: 19 Jan 2021

Mikolaj Zielinski
Automation Developer

Wrocław, Poland


License

MIT


Code Language

Visual Basic


Runtime

.NET Framework


Tags

datatable
Look
Look in table
Lookup
Powersearch
query
search
Vertical search
Vlook
vLookUp

Compatibility

Studio: Pro 2020.10-2-beta.4+


Dependencies

Microsoft.Activities.Extensions System.Data.DataSetExtensions



Similar Listings