I need to retrirve the unique countries names from data and store it in some variable?

I created a spreadshee which has multiple columns for example:

eg:=-

Name, schoolname, country
rokky ops pak
vergv efvvfe ind
ete erffeef pak
fievne uvnfe ind
rokky ops pak
vergv efvvfe ind
ete erffeef pak
uifbhuve ojveovef USA
fievne uvnfe ind
rokky ops pak
vergv efvvfe ind
ivfn invfi USA
ete erffeef pak
fievne uvnfe ind

I have multiple rows [with corresponding name, age and gender]

there are different people from diffrent countries.
I need to store distinct country names, in a variable and display it using write line.
ie:-
assign UniqueName = {“USA”,“ind”,“pak”}

@Error, Refer this,

Note : Use the query and change the column name.

Regards,
Dominic :slight_smile:

sorry, but i didnt get what you meant there/ \

can yiou give me some sampleor edit my project and send me plz???

Main.xaml (9.5 KB)

@Error, Sorry I couldn’t Upload Xaml. Follow these steps,

  1. You already have a variable named datatable that has all your input from read range activity

  2. Create another variable name arr of variable type String[] (String Array)

  3. Use Assign activity and paste the query right hand side and assign it to arr left hand side,
    arr = (From row in datatable Select Convert.ToString(row(“Country”))).Distinct().ToArray()

  4. Now arr contains your desired output.

Regards,
Dominic :slight_smile:

use the string variable to do that;

@Error

Use Assign activity and paste the query right hand side and assign it to arr left hand side,
arr = (From row in datatable Select Convert.ToString(row(“Country”))).Distinct().ToArray()

To Display this using write line

try this in write line activity,
string.Join(“,”,arr)

Regards,
Mahesh

1 Like