# Formula for "Column Expression" node from Variable

Hello to everyone!

I want to use the variable that I created earlier as a formula.
How can I pass this variable to Column Expression as a formula?

Nothing stands out as obviously wrong. I built a toy example and it worked fine.

Do you get an error message when you run this?

I got error (I don’t use function toDouble() with variable):
ERROR Column Expressions 5:336:323 Execute failed: An error occurred in script 1:
Error occurred during the conversion of the result ‘column(“Стоимость на начало”, -1) + column(“Переоценка”, -1) + column(“Процентные доходы (начислено)”, -1) + column(“Процентные доходы (получено)”, -1) + column(“Реализация/Погашение”, -1) + column(“Приобретение”, -1) + column(“ЦБ на конец по данным ОСВ”, -1)’ to ‘Number (double)’.

After used function toDouble() with variable:
ERROR Column Expressions 5:336:323 Execute failed: For input string: “column(“Стоимость на начало”, -1) + column(“Переоценка”, -1) + column(“Процентные доходы (начислено)”, -1) + column(“Процентные доходы (получено)”, -1) + column(“Реализация/Погашение”, -1) + column(“Приобретение”, -1) + column(“ЦБ на конец по данным ОСВ”, -1)”

Example with function toDouble:

Oh, I did it.
Firstly, I concatenate my formula with expression “if” in “String Manipulation (Variable)” node :

And I get new formula like this
if (rowId() != "Row0" & column("Наименование инструмента") == column("Наименование инструмента",-1)) {column("Стоимость на начало", -1) + column("Переоценка", -1) + column("Процентные доходы (начислено)", -1) + column("Процентные доходы (получено)", -1) + column("Реализация/Погашение", -1) + column("Приобретение", -1) + column("ЦБ на конец по данным ОСВ", -1)} else {column("Стоимость на начало")}

After that I passed this variable with the new formula to the “Flow Variable - Expressions” section in Column Expression node.

And it’s works!

1 Like

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