I am using a get row item action but I am wondering if i can put a range in the columnindex field to get multiple columns in that row
The columnindex field returns the current index of the row you’re on. If you want to iterate over the columns in the row, use a For Each activity and iterate over row.Columns. You’ll need to convert the item (e.g. col) to a string to use it as a reference in your row item.
@josh.cusack May I know if there is any specific reason you are using Get Row Item Activity ?
I want a specific row but I would like every column of the table for that row. Why isn’t there a “get row” activity?
@josh.cusack Do you know which row it is ? You can use Read Row Activity if that is the Case. Check on that Activity Please
I dont know the exact row number but If the value “x” is in the row then read that row.
@josh.cusack Are there many rows with value x or will it always be 1 row with x value?
there could be many or none.
@josh.cusack Is it possible for you to tell us your Use Case Scenario? If there are many rows, How will you process it, and if it’s only 1 row How are you going to Process it?
Basically we can get that specific row/rows what you need but to get the Values From it you’ll need to use For Each and get the Specific Values
essentially its an excel sheet with a table that i need to split apart and send out to different entities and the entities are identified by a key value in one of the columns.
I have already made a loop that goes through that column and identifies non-duplicate key values. next i was going to loop through an if statement. if row possesses key value add entire row to this sub-data table and repeat for each type of key value identified in the earlier for each.
@josh.cusack Ok, I guess I understood your Scenario. You’re Classifying the Excel Data to Multiple Excel Data based on Value of a Column , Is that right ?
Yes. but I am having trouble with the part of picking up the entire row once I have properly classified it.
@josh.cusack The “Sub-Data” that you have mentioned, Is it like a Datatable, If it is a Datatable? How many sub-Data’s have you created ?
yes the “sub-data” are datatables but they contain a subset of the rows of the larger original datatable. that amount varies but could be over 20
@josh.cusack grab the row you found into a System.Data.DataRow variable and then use the Add Data Row activity
original and target data tables must match structure
@josh.cusack Can you provide a Sample Input File ?
I tried that but I get an error saying this row already belongs to another table. for some reason it cant be in the original table and my new table at once?
That’s right.
You’ll have to do something like:
tempRow = outputDT.NewRow()
//fill tempRow with the columns in inputDT
tempRow(column) = inputDT_Row(column)
Add Data Row Activity (DataRow = tempRow, DataTable = outputDT)
I am not really following that train of thought
-
Create a temp variable of type System.Data.DataRow, say tempRow.
-
Use the target DT to get a DataRow object
(reportDt here is the target DT, I think in your case is Output) -
Fill tempRow with the data of the desired row from input data table. Probably you’ll have to loop through the columns
-
Once your tempRow has all the data, use the “Add Data Row” activity