expression replacement

Hi All,
I have an input file (attaching as well)INPUT_DATA.xlsx (9.2 KB)

|TAXONOMY_VALUE|FORMULA_TAXONOMY_ID|FORMULA_TAXONOMY_ID|SEPARATE_LIST|
|10|F_1|A+B|A|
|20|F_1|A+B|B|
|10|F_2|C+D-A|A|
|30|F_2|C+D-A|C|
|40|F_2|C+D-A|D|

on which i have applied groupby node on two columns
FORMULA_TAXONOMY_ID,FORMULA_TAXONOMY_ID and done aggregation ,below is the output
for groupby
|FORMULA_TAXONOMY_ID|FORMULA_TAXONOMY_VALUE|TAXONOMY_VALUE (List*)|SEPARATE_LIST (List)|
|F_1|A+B|[10.0, 20.0]|[A, B]|
|F_2|C+D-A|[10.0, 30.0, 40.0]|[A, C, D]|

After this i want to create one new column in which i am having the resolved expression for field FORMULA_TAXONOMY_VALUE
For eg:
new column value should be 10+20 for the first row and 30+40-10 for the second row.
that is TAXONOMY_VALUE (List*) contain the numeric value need to replace the value in column FORMULA_TAXONOMY_VALUE
For this i have written the logic in column expression. but it is giving the last expression only and not the complete value and can see one more issue
split function can only take one symbol as an input separator but FORMULA_TAXONOMY_VALUE can have multiple separator.
Attaching the workflow as well.Kindly Help me to achieve this.https://kni.me/w/HTx6txddvJfa27Yy

Hi @sahil786,

thanks for sharing your workflow. I adjusted your workflow a little bit and this will hopefully solve your problem.

  • First, I created a replacement table, which contains the letter A,B,C,… in one column and the corresponding values 10,20,30,… in the other column.
  • Then, I use a recursive loop to take the first row of the replacement table and replace each letter by its corresponding value in the original table.

Here is the workflow: ExpressionReplacement.knwf (28.2 KB)

Let me know if this solves your problem or if you need further help.

Best,
Janina

1 Like

THANKS A LOT… :grinning:

Hi @janina,

It is not working for F6,F7,F8 only working for F1 and F2…Can you please help me on this?

Hallo @sahil786,

you simply use an additional Recursive Loop to replace the values for F6, F7 and F8. Here is a workflow example: ExpressionReplacement_2ndIteration.knwf (49.3 KB)

Best,
Janina

1 Like

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