Create Custom Index for Uipath

Hi all,

Is it possible to create an index that is concat with a string alphabet with UiPath?

image

TestingData.xlsx (9.9 KB)

Attached expected output on this.

Thanks for the assistance.

Regards
Hidayat

loop over the data table rows with a for each row / for each row in data table - configure the output index of this activity e.g. to variable idx

inside the for each row body:

  • AssignActivity: row(“Index”) = idx.toString & a

As an alternate done with LINQ:

Hi @Md_Hidayat

Check out the XAML file

AddIndex.xaml (6.7 KB)

Regards
Gokul

Hello @Md_Hidayat
You can get the current index for each row data table as an integer.
Use write cell activity, increment the Index with 2 (if the value starts from row 2), and pass the index value with the required content.
Refer to this Xaml file you may get some idea
Forum_ADDindex.zip (144.6 KB)


o

1 Like

HI @Md_Hidayat

You can also try with this expression

(From d In Dt_inp.AsEnumerable
Let b=d(0).ToString
Let c=Dt_inp.Rows.IndexOf(d)
Let res=New Object(){b,c.ToString+"a"}
Select Dt_Out.Rows.Add(res)).copytodatatable

Steps like this

  • Read range input file and store in the variable DT_inp or something.
  • Add Data column “Index” to DT_input variable
  • Assign another datatable variable “DT_out” = Dt_Inp
  • Clear Datatable Dt_Out you will get the headers without the data.
  • Assign Dt_input = The linq expression i shared
  • write range Dt_out you will get the output

Hope this helps

Regards
Sudharsan

1 Like

Thanks for the help @Gokul_Jayakumar !

@Sudharsan_Ka Thank you Sudar!! Great way to practice Linq expressions.

Both able to return expected result. :grinning: :+1: :100:
Have a good weekend!!

1 Like

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