Add column with condition

Question

Hello guys, I would like to ask
I want to create item 12 made it for new order blah blah

YYYYY item 10 = 5000
XXXXX item 10 = 4000

so need to split item 10+1(11) = 1000 but there is item 11 already , so need to create 12 instead how to built item 12

Hello @Suniagoz

  1. Initialize Variables:

    • Create variables to store the item details.
  2. Read Existing Items:

    • Use a DataTable to store your existing items.
    • You can populate this DataTable from your data source, such as an Excel file, database, or CSV.
  3. Check for Item 11 and Create Item 12:

    • Use a For Each Row activity to iterate through the DataTable.
    • Inside the loop, check if the “Item Name” column contains “Item 11”.
    • If found, create item 12 with unique details and add it to the DataTable.

    For Each row In yourDataTable
    If row(“Item Name”).ToString().Trim() = “Item 11” Then
    Item 11 already exists, create item 12
    Dim newItemName As String = “Item 12”
    Dim newItemPrice As Double = 1000.0
    Dim newItemQuantity As Integer = 1

        Add item 12 to the DataTable
        yourDataTable.Rows.Add(newItemName, newItemPrice, newItemQuantity)
    End If
    
  4. Update Data Source:

    • If you’re working with an Excel file, use the “Write Range” activity to update the Excel file with the modified DataTable.
  5. Communicate Changes (optional):

    • Use a message box, log message, or email notification to communicate the addition of item 12.
  6. Save and Execute:

    • Save your workflow and execute it in UiPath.

Thanks & Cheers!!!

1 Like