How to handle a data table without headers?

Hello, people!

I have a data table with only one column containing certain data. I have used an add data column activity to add a new column to this data table.

Now, I want to insert pre-calculated values to the newly added data column based on the data in the first column.

I created a workflow using some expressions but that doesn’t seem to be working as I wanted it to.

Say, if it’s Code_A then I have calculated value that goes adjacent to this cell.

Here’s a screenshot for your reference of what I’m trying to achieve:

Kindly help me with this!

1 Like

Hi @monsieurrahul,
If the second column name is not mandatory, then you can achieve this by using column index in datatable.

For eg:
For each row in datatable
If row(0). tostring.equals(“Code_A”)
Assign row(1)=adjacent
Like that,

1 Like

I thought using column index might not be appropriate because usually, we prefer to use row(“column name”) to row(“column index”) but in this case, I think I don’t have much of a choice.

I figured out another way as well which is, adding headers to the headerless data table, process it using headers, and then write it back to Excel without headers but even in this case, I’m using the index to set column names.

Anyways, thank you very much for your help @shankm :slight_smile:

1 Like

If you still don’t want to use the column index, try the following steps. It may help.

  1. use build datatable Activity with your required headers
  2. iterate on first datatable, then add each row to the second datatable, which we built in 1st step
    Now you have a second datatable with headers and the data from first datatable
  3. iterate on the second datatable and
    If row(“first column name”).tostring.equals(“Code_A”)
    Assign row(“second column name”)=adjacent

Hope this will help.:slightly_smiling_face:

1 Like

Sure, I’ll try this out as well! Thanks, again @shankm :slight_smile:

1 Like

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