Writing in particular rows

Hi Team,

I have a datatable containing,
Invoice number, starting index, ending
abc,2,2
zyz,3,6

So, i want to write in the rows from starting index to ending index, like in a column i want to write success in particular rows. How am i able to do it?

Hi @yash.choursia,

Please use do while acitivty to loop from start index to ending index and assign your invoice number value to desired column using this syntax: your_datatable_name.Rows(index)(column_name).

Regards,

@yash.choursia

  1. Use the Read Range activity to read the DataTable and store it in a variable (e.g., dtInvoice).
  2. Add a For Each Row activity and set the DataTable property to dtInvoice.
  3. Within the For Each Row loop, add an If activity. In the condition, check if the row index (use dtInvoice.Rows.IndexOf(row) + 2 to account for 0-based index and the header row) is greater than or equal to the starting index and less than or equal to the ending index.
  4. Inside the If activity, add an Assign activity to set the value “Success” in the desired column (e.g., dtInvoice.Rows(dtInvoice.Rows.IndexOf(row))(“Status”) = “Success”).

Hope it works!!

Hi @yash.choursia

  1. Use a For Each Row activity to iterate through the rows of “dtData.”

  2. Inside the For Each Row loop, use an Assign activity to convert “starting index” and “ending index” columns to integers.

    Assign:
    startingIndex = CInt(row(“starting index”).ToString)
    endingIndex = CInt(row(“ending index”).ToString)

  3. Use a nested For loop to iterate through the rows within the specified range.

    For i = startingIndex to endingIndex
    dtData.Rows(i-1)(“Status”) = “Success” // Since the index is 0-based, subtract 1 from the startingIndex.

  4. After the nested loop, the “Status” column will be updated with “Success” for the rows within the specified range.

I hope it helps!!

Hi @yash.choursia

For Each Row (Row in dtInvoiceData)
Assign (startIndex)
To: startIndex
Value: Convert.ToInt32(row(“starting index”))

Assign (endIndex)
To: endIndex
Value: Convert.ToInt32(row("ending"))

If (Condition)
Condition: row.Table.Rows.IndexOf(row) >= startIndex - 1 And row.Table.Rows.IndexOf(row) <= endIndex - 1
    Then:
        Assign (status)
        To: row("Status")
        Value: "success"

Hope it helps!!

Hi @yash.choursia

Use for each row in datatable:
Assign: CurrentRow(“starting index”) = “value”
Assign: CurrentRow(“ending”) = “value”

Hope it helps.