Calculate X = 10 * Y + X within a single MAP step

Can one calculate X = 10 * Y + X in a single step (i.e., as a single expression), in a Flow service?
– It is crazy to have a separate MAP for each elementary math operation!


X = 10 * Y + X

is not a possibility, then, maybe,

Z = 10 * Y + X

is, at least?


the easiest way might be to write a java service doing the calculation and invoke this one from the flow service.


Writing a java service would be even more insane for this purpose than invoking multiple simple operations. I agree that the situation is absolutely horrible for anyone coming from other programming languages.

One could create a java service that would calculate any math expression – e.g. using JavaScript in the implementation. I’m not sure about the performance, but if it doesn’t matter then math calculations would be much more elegant. E.g. create a service having 5 parameters: x, y, z, t and expr. Expr is a string that specifies the expression to calculate. In the expression, you can use x, y, z and t. This would be a universal calculator for expressions having no more than four variables.

But the truth is that (at least according to my experience) complex math calculations are a rare thing in wM code. wM is used for integration where calculations usually do not happen often.

As mentioned above, you can create a java service and perform mathematical operations. You can still do the same via flow, not with a single map step.

I think SAG should support this feature like other tools where we can write expressions and provide a result.

You can raise a feature request on SAG Brainstorm.

Holger, fml2 *, M@he$h, all your answers are good, thank you!

And, M@he$h, I will try to accost the SAG Brainstorm with this :wink:


Don’t expect too much. In my experience, brain storm is like the null device.

1 Like
  • That’s, probably, so about any facility alike…

Anyways, I think, I’ll give it a shot. We’ll see what comes out )

1 Like