How to assign one variable to a set of cells


Hello Folks,

i want to assign no of cells that exist in last row only (highlighted in green to one variable ) to use it in a for each loop later , any advice ?

Can you elaborate?
Like are you trying to find the number of Non-Empty cells in last row?

1 Like

i want to create variable x ={supplier email1 ,supplier email2 , supplier email3 } as strings to use it in for each loop

hey @sesa499170 ,

can you tel me headers of these required column ? so that i can use LINQ

regards,
Dheerendra Vishwakarma

Hi @sesa499170

Try this

Input:

image

Output:

image

Sequence5.xaml (12.8 KB)

Cheers!!

1 Like

hi @sesa499170 ,

You can do something like this:

  1. Read Range D5:F5, this returns a datatable dtSupplierEmail
  2. For each row in datatable
    2.1 Assign strSupplierEmail = CurrentRow(“ColumnName1”).ToString + “,” + CurrentRow(“ColumnName2”).ToString + “,” + CurrentRow(“ColumnName3”).ToString

Hope this helps

hello @sesa499170 ,

you can achieve your goal using 2 assign activity i have used LINQ for faster processing and efficiency.

As you can see

in first assign i have extracted required columns as store it in datatable variable and in second assign acivity i have extracted last row and storing it in out_VAR(Array of string type)

first assign replace the headers

 n_DT.AsDataView.ToTable(False,{"Header of Suplier email1" ,"Header of Suplier email2","Header of Suplier email3"})

and second assign extracting last row and storing it in array of string variable

Required_DT.AsEnumerable().Last().ItemArray.Select(Function(x) x.ToString).ToArray()

after this you can use for each activity and pass above output variable(out_VAR) to see the result.

i am attaching .xmal file for your refence just replace the headers in first assign you will get your result easily

new_mode(Autosaved).xaml (9.3 KB)

hope it will help you

Regards,
Dheerendra Vishwakarma

take assign activity LastIndex = Table.RowCount-1
then take second assign activity Array = {Table(LastIndex)(coulumnIndex),Table(LastIndex)(1),Table(LastIndex)(2)}

1 Like

@sesa499170 if you got the answer please don’t forget to mark it as answer so that this topic can be closed
Happy Automation!!

1 Like

Thanks A lot , it works , many thanks for all of you :slight_smile: , great help

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.