Hello

In my scenario, after creating a datatable from excel extract I needed to add 4 data columns (L, M, N, O). The values of newly added data columns are calculated from previous columns by applying certain formulas or getting values from web application.

- column L is calculated based on (I-J)*-1. Since I and J columns may have spaces, I am not able to apply the formula. What conversion would be required.
- Column M values(numeric) will be retrieved from web application. This will happen later in workflow. However this value need to be used to calculate column N.
- Column N is calculated L+M. - How should I handle this. values of L is from data table and values of M is from web application ( later in workflow)
- Column O - from web application alpha numeric, not used for any calculation.

Thanks for the help.

Best Regards

Use Add data column activity first to insert the columns.

you can use this expression in the assign activity

YourDatatableVar.Columns(“ColumnN Name”).Expression = “ColumnLName + ColumnMName”

Note: If ColumnL Name has spaces you have to surround with the square brackets…

For Ex: “[First Name] + [Last Name]”

Similar try it on the others bullet points and let share if you get any errors…

Thanks Guru. recommended solution did not resolve the issue. 1st bullet has to be calculated before 3rd in order to capture column L values.

How do I handle where one value is coming from Excel and other value is coming from web application in this formula. Here web application steps are not processed yet.

Hi @skg_161125 … It would be quite difficult without seeing whats in column J.

If you have more spaces then you have to cleanup first before applying formula…like using replace or trim or Regex…

In this case, you may need to finish write everything from the web app first before proceeding the calc step.

Mainly Column I and J has numeric values. but there are instance row values are blank.

Once I have column A and Column C value from excel, I have to pull a record from web app. from that record, I will collect value for column M and Column O. Thereafter column L ((I-J)*-1) and column N(L+M) will be calculated. This need to be done for each record in excel.

@skg_161125 - it would be great…if you could share some sample(masking or dummy data) excel sheet and screenshot with us…

Excel Template.xlsx (8.9 KB)

Attached is the sample data. Column L to O will added to this file.

Column L value will be created using formula (I-J)*-1

Column M will be captured from web app ( numeric values)

Column N value will be calculated using formula L+M

Column O will be captured from web app.

Thank you.

@skg_161125 - Is this the result you are looking in Column L?

Question: Can you do J-I instead…

Apologize, formula in the first post just concatenates the column…so pls ignore…

Calculation is correct but formula has to be (I-J)*-1

@skg_161125 - That is what is there…i just showed the formula in excel…But you didnt answer my question yet??

@skg_161125 - One idea i am thinking is…First you have to replace all the spaces with 0 in column I and then simply using write cell in column L (assuming you dont have lot of rows) with forumula and use AutoFillRange it will automatically copies the formula to the subsequent rows…

@NIVED_NAMBIAR - Any thoughts…using Invoke Code…???

Hi @prasath17

So u mean to replace all the spaces / empty cells with 0 in overall?

Column I and J …As per @skg_161125

What he mean by spaces is it empty or there is any space before or after any character?

@NIVED_NAMBIAR - I guess like this…

@skg_161125 - Please add your comments…

@NIVED_NAMBIAR @prasath17 : These are just empty/blank cells. No spaces.

@skg_161125

You need to perform following operations on your data variable

1.` Add 4 columns and give them name as per your requirement`

2. For each row

Use 4 assign

- dt(“Column L”)=“=(I2-J2)*-1”
- dt(“Column M”)=“NumericValuefromAPP”
- dt(“Column N”) = “=L+M”
- dt(“Column O”)=“Captured Value from webapp”

This will append formulas on your datatable and not actual values.

Any information that you change on other column will impact your data

@skg_161125 - please find some starter help here…Just to let you know, it may not be perfect…but at least this will give an idea for you to proceed further…

Datatable calculation_SG.zip (44.8 KB)

Hint from the workflow…

Output

Hope this helps…