Formatting 2 DataTables to look the same

I am working on eventually comparing the two datables below, I would like the format
image

To look the same as the one below:
image

I would like the tables to both have Form ID, Form Edition and Form Title as the columns with the same formatting as the second.

Eventually I will be using these to compare for values that are matching and values that are not matching. The not matching values will then be outputted into a new table for use later to enter into a website.

Any help?

Regards

Try datatable activites like remove data columns. Then use string functions to remove spaces in bad formedition then use string function for formatting the new value as badFormEdition.tostring(ā€œ(00/00)ā€)

@ajeffers I would create a brand new datatable that is a clone of the datatable you want in the end. Iā€™ll assume your first picture is dt1, your second pic is dt2 (this is the one you like the schema/structure), and youā€™ll create a new table called dt3 which is just going to be the same info as dt1, but with the schema of dt2.

  1. Assign dt3 = dt2.clone // this copies the layout of dt2 to be used for the new datatable
  2. For each row in dt1
    2a. Assign FormID = row.item("FormPrefix").ToString + " " + row.item("FormNumber").ToString
    2b. Assign FormEdition = "(" + row.item("FormEdition").ToString.replace(" ","/") + ")"
    2c. Assign FormTitle = row.item("FormTitle").ToString
    2d. Add data row activity with the following properties: ArrayRow = {FormId,FormEdition,FormTitle} // Datarow = (leave this blank) // DataTable = dt3

Now you have 2 datatables (dt2 & dt3) in the same format

1 Like

I utilized this and it seems to be workout, I also inserted output table after and logged it out to a string. Is there a way I can output this into a another datatable variable? Iā€™m using it in a subworkflow and I want to throw it be able to move it out of the workflow itā€™s currently sitting in, in tact with the new format.

just create a new datatable variable and set it equal to the datatable you want to copy. d1New = dtOld

@ajeffers, instead of having it be a variable named dt3, change it to an argument called dt3 (or whatever you want to name it). Make sure the direction for the argument is set to out.

Then when you invoke the workflow you can click the ā€˜import argumentsā€™ button and it will pop-up the box to set the arguments from this workflow to variables/arguments in the workflow that invoked it

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.