How to get several "get row item" in UiPath

dear, I would like to know how to use multiple “get row item” on Excel and use multiple “switch” function?

when I use the 2nd “get row item”, it appears an exception saying that “Get row item : StringConverter cannot convert from System.Double.”.

thanks for reply~

check the datatype and assign it to generic or just delete that activity or recreate it and let me know :slight_smile:[quote=“MichaelC, post:1, topic:3786”]
use multiple “switch” function?
[/quote]

Consider “Flow Switch” then Use Inside that you can use “Switch activity” i guess. Just familiar with such activities and try to use as per your needs.

Regards…!!

thanks, hv checked the datatype as string but it shows the below exception box:

thanks for the solution

Hey @MichaelC

You can use Generic data type as an output vairable for “Get Row Item” Activity because when you will use “Ctrl+k” it will create a variable of Generic data type for that activity but still you can use string data type as well depends on input excel data datatype.

For your reference : Sample.zip (6.9 KB)

Regards…!!
Aksh

thanks for your reply. I can perform “get row item” as well. what I cannot perform is to get multiple row items…may I know if UIPath hv similar function of getting multiple row items and save to different string output? thanks~

1 Like

If i am not getting you wrong you wants to use Multiple times “Get Row Item” Activity?? or? something else?
Check that sample.zip again. It works…

Regards…!!

1 Like

Hi @aksh1yadav . I have the same question as @MichaelC

If I need to "get row item’ for 30+ variables, is there a shortcut way or do I need to individually setup 30 “get row item” activities? For example, is there a way to write a script for this?

Why can’t you use the DataTable variable(arguement) all through the project?

For eg: The below will return the Age column value from 1st row

dt.Rows(0)(“Age”).ToString

or you can use foreach whereever you need.

  1. You can get the row values in a dictionary and pass it as arguments to multiple workflows.

    Dictionary<String, String> items = new Dictionary<String, String>() {
    {“name 1”, “value 1”},
    {“name 2”, “value 2”}
    {“name 3”, “value 3”}
    };

1 Like

Thank you @vvaidya . I have not used arguments or dictionary until now. I will work through the examples:

here for arguments and,
here for dictionaries

Hi @aksh1yadav, is it possible to use get row item ones and select all the columns for that row. If I have over 50 columns, its quite troublesome to get row item for each column over 50 times.

1 Like

Hey @tobor, @MichaelC and @ZacZ

Yeah i have a way,

Please find below attached sample workflow and let me know if any doubts you have :slight_smile:

Single_GetRowItem_to_fetch multiple_columns.zip (15.9 KB)

Regards…!!
Aksh

Hi @aksh1yadav, it looks great! just a quick question, im pretty new to UiPath, where can I find all the functions like dt1.Columns.Cast(Of DataColumn).Select(function(x) x.ColumnName).ToArray(). Im not sure which are the syntax that are compatible in UiPath :slight_smile:

Btw how do I paste them into excel workbook in the same format? I don’t really know how to iterate row by row, so currently if I use add data row, all the information will be in one column instead of row by row

what you wants to paste?

Regards…!!
Aksh

@aksh1yadav basically im trying to select certain entries and write those rows to another excel workbook. The video tutorial from the website shows how to do that if there are a few columns, https://www.uipath.com/tutorials/excel-and-datatables-automation, for this video, the last example is what I am trying, just that instead of the 3 columns, is there a way to read multiple columns at the same time instead of creating a get row?

what i am getting is you want to store data(By using Add Data Row?) into datatable so you can write it into an Excel file ???

Video is not playing because of security policy.

or still facing problem with the above thing?

Yes that’s right @aksh1yadav

This link will help you on this:

just pass that datatable to a write range activity inside an excel application scope.

Regards…!!
Aksh

1 Like

Hey hi @aksh1yadav I just need explanation for the code " dt1.Columns.Cast(Of DataColumn).Select(function(x) x.ColumnName).ToArray()." what is that function(x).? what x stands for?? Please reply me as soon as possible. because i need same line of code to extract data…

regards,
Praveena

Hello mate, what is the variable type that you have selected for col_name variable?

You can see it in variable pane easily.

as you asked - It is String[ ](String Array).

Regards…!!
Aksh