i found out that in the column expressions node one can interestingly multiply numbers that are saved as string and add them with no problem. Like:
1 x stringNumber1+ 1 x stringNumber2=15
it gives the correct result.
But if i write:
stringNumber1 + stringNumber2=510
So weirdly it attaches them together like using a joiner.
But i still wonder if this is safe, has anyone experience with this? or is there a better way of using string numbers in the column expressions node?
When you add strings together they simply concatenate.
But in your first example, you cast the strings to a numeric type because you multiplied by one.
I don’t recommend using string numbers; you should convert that column of strings to numbers first (using string numbers is confusing and not best practice).
yeah i read later that day more about this. Like in your second llink it kinda always sound that this is just a normal thing to do. That this just starts the type-change of the the variable and sind JS is dynamically typed anyways. I don’t understand what would be the difference if i make it with toint an integer first.
Or are there other things other than “readability”/more confusing in the CE node to consider?
How would you transform it? With toint in the CE node or does it have to be on another previous node changing it?
Have a good Whitsunday…
In the programming languages I know, there are many ways to do the same thing. It’s just preference. For readability, I would use a function and not multiply by 1 to make it clear exactly what you are trying to achieve.
I would first transform the entire column from string to int using a node or function and then do the addition. (So in the previous node). This makes the Column Expression node much cleaner and easier to read which is best practice in code-writing.
thanks for your input on this…An extra node is a bit cumbersome but i will think about it…
Have a good one…