I am working on creating a report for users being added and removed from distribution lists. I want a column for added users and a column for removed users. I have tried building separate data tables and merging them together but since the number of rows in each column doesn’t match it doesn’t work properly. I tried joining the data tables but since there are no similarities that also does not work. I then tried passing the data table between the Xaml and writing into the same data table and that was closer, but it had a blank line where a user had been added in the user added column (please see below). Is this even possible? If so how would you recommend accomplishing this task. I am using UiPath Studio in C#.
Yes, it is possible to create a report for users being added and removed from distribution lists with separate columns for added and removed users. Here are some possible ways to achieve this using UiPath Studio in C#:
- Use a single data table with three columns: user name, status (added/removed), and timestamp. Whenever a user is added or removed from the distribution list, add a new row to the data table with the appropriate values in the three columns.
- Use two data tables, one for added users and one for removed users. Each data table should have two columns: user name and timestamp. Whenever a user is added or removed from the distribution list, add a new row to the appropriate data table with the user name and timestamp.
To combine the two data tables into a single report, you can use a join operation on the user name column to match up the rows for each user. Alternatively, you can merge the two data tables into a single table and use conditional formatting to highlight the added and removed users.
I don’t think a join operation would work because nothing would be matching between the two tables. To set the valid argument to join. I tried to merge the two and it removed the remove column I am assuming this was because the number of items in the rows were not the same.
Have you tried merging the two tables using the “Merge Data Table” activity and the resulting table is missing the “removed” column, it may be because the columns in the two tables have different data types or column names.
To ensure that the “removed” column is not removed during the merge operation, you can use the “Add Data Column” activity before merging the tables to create an empty “removed” column in the destination table. This will ensure that the “removed” column is retained during the merge operation, even if it is not present in the source table.
If none of these options work, you may need to consider a different approach, such as creating a separate table for added users and another table for removed users, and then combining them into a single table with a common key.
I was able to get the merge to show both columns. Would you know I can place both next too each other?
This the Data Table layout for both Tables
you can place both tables next to each by using the “Add Data Column” activity to add a new column to one of the tables and populate it with the data from the second table.
Here are the steps:
- Drag and drop the “Add Data Column” activity from the “Data Table” category into your workflow.
- In the “Properties” panel, specify the following values:
- “DataTable”: Select the table that you want to add a new column to.
- “ColumnName”: Give a name to the new column.
- “DataType”: Set the data type of the new column.
- “Expression”: Use an expression to populate the new column with the data from the second table. For example, you could use the following expression if the second table is named “dt2”:
- Drag and drop a “Data Grid” activity from the “UI Automation” category into your workflow.
- In the “Properties” panel, specify the following values:
- “DataTable”: Select the table that you added the new column to.
- “Columns”: Select the columns that you want to display in the grid.
- Drag and drop a second “Data Grid” activity next to the first one.
- In the “Properties” panel for the second grid, select the second table as the “DataTable” and choose the columns you want to display.
- Run the workflow and the two tables should be displayed next to each other in the data grids.
@Nitya1 Thank you for your help! Unfortunately, I do not have Data Grid. I am pretty sure that is part of Studio Pro from what I am finding. I only have studio.
Hi @jolsen Sounds like the data is not properly added to the data table. Can you try below steps
- Use build data table (initialization phase if using Re-Frameowrk) with defined columns User Added and User Removed
- Pass this data table between XAMLs
- Once the User Added and User Removed values available then use
Add Data Row activity to add the row data at once OR
- Use increment variables to insert the data in the specific rows
Check below workflow for ref
DataTable_Manipulation.zip (2.9 KB)
If the order is same and if you just need to paste the data in excel one beside another…then use write range two times with each datatable and change the cell numbers accordingly for the first A1 and for the second C1
Hope this helps
I am using a REF framework. The problem I am running into is that the Add users and Remove users are in different XAMLS and none of the users relate to each other and can not be checked at the same time to add rows for both add and remove together. So when the Add users XAML runs it places the users in the left column and when the remove users runs it places the users in the right column but below where the users that were added are listed like below. I would prefer it place them in a table just next to each other. This going through around 100 different teams utilizing a queue and each team includes 6 sub emails.
Unfortunately, this wouldn’t work because each location has different teams that have to be separated. After a teams is added it appends a CSV file to save the current data. So, the A1 and C1 would not always be the location that the data needs to be added into.
first get the them into two different datatables and remove the empty rows by filtering then go for below approach of combining two columns with different rows
Hope this helps your requirement