Hi Rafal,
Â
I guess you use the formatNumber() function in an action flow? The error that you get is caused by an empty SUM result. In other words, only NULL values are summed which result in NULL. NULL is nothing, not an empty string, not 0. This is also what the error says, 'NaN' stands for 'Not a Number'. Therefore, the formatNumber() cannot be applied.
Â
You can solve this in multiple ways that I can think of:
- Be sure that the sum will never be empty (add 0 to it to make the sum 0, which is actually a number)
- Bypass this step by using rerouting when the sum is null
- Depending on the next steps, let the flow ignore this error and just continue.
Â
I hope this helps!
Hi @janpeter.van.d, thank you for your answer.
Yes, I use it inside an action flow.
Indeed, in some cycles probably NULL values are summed.
I tried to add 0.0 in every cycle of the flow to this sum, but it doesn't work - I still receive The operation failed with an error. Failed to map 'formula': Function 'formatNumber' finished with error! 'NaN' is not a valid number or using unsuitable separator.
Â
The structure which causes the problem is formatNumber(SUM(...);2).
... = CASE WHEN construction
I tried with
- formatNumber(0.0+SUM(...);2)
- formatNumber(ADD(0.0,SUM(...));2)
- formatNumber(SUM(0.0,SUM(...));2)
- formatNumber(SUM(0.0+...));2)
- formatNumber(SUM(ADD(0.0,...));2)
- formatNumber(SUM(SUM(0.0,...));2)
but it is still the same error, I guess that tries of addition didn't change NaN to 0.0.
The effect that I would like to get is for example omitting NaN cases by formatNumber() function.
the problem is that in the moment you get a NULL, being nothing, you can't add, modify, etc...
Â
Maybe in the quey when you get the results, add something like CASE WHEN column IS NULL then 0 ELSE column END
Â
HTH
the problem is that in the moment you get a NULL, being nothing, you can't add, modify, etc...
Â
Maybe in the quey when you get the results, add something like CASE WHEN column IS NULL then 0 ELSE column END
Â
HTH
This would be my suggested solution too!
@Guillermo Gost ,@janpeter.van.dÂ
Thank you for your advice. Of course it sounds logical, but I still receive the same error.
Maybe something is wrong with my syntax?
The logic itselfs seems alright to me. However, I don't think you can use PQL in this Action Flow fields (sorry, I missed the part that you mentioned that). Since Action Flows are an incorporated different product (google on Integromat), the syntax is differently.
Â
To do a sum here, use the syntax mentioned under Action Flows: Math functions (celonis.com), being sum ( array of values]), sum(value1;value2; ...)
Â
I hope this helps!
The logic itselfs seems alright to me. However, I don't think you can use PQL in this Action Flow fields (sorry, I missed the part that you mentioned that). Since Action Flows are an incorporated different product (google on Integromat), the syntax is differently.
Â
To do a sum here, use the syntax mentioned under Action Flows: Math functions (celonis.com), being sum ( array of values]), sum(value1;value2; ...)
Â
I hope this helps!
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
Hi Rafal,
Â
Sorry for the confusion. Both formatNumber() and sum() are supported in Action Flows, since they are specified in the math functions. CASE WHEN statements however are PQL/Vertica and therefore not supported. So yes, you can do summations combined with formatNumber, but the part that fails is the CASE WHEN statement.
Â
You can use other functions however that are similar:
Â
I hope this clarifies
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
I was suggesting to put that CASE WHEN in the Query component
Â
but, if that is not an option, it seems that with a Switch component you can implement it (I haven't tested, but it looks promising)
Â
Â
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
@janpeter.van.d, it didn't help. Still the same error. And I had this CASE WHEN construction before in this Query Data module and it was okay. Only the connection of this and this formatNumber() causes a problem.
Â
@Guillermo Gost, all this takes place in the "Query data" module. Inside a window with a formula for one of columns.
Â
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
Hi Rafal,
Â
Sorry, I wasn't aware that you was working in the Query Data module. Since this is a module created by Celonis itself, if can actually handle PQL queries.
I do not have experience with this situation, but maybe the PQL equivalent of formatNumber could help here? See ROUND (celonis.com) for more information.
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
Yes, I tried with ROUND(), but having eg. 12345 number, the result of the ROUND(12345,2) will be still 12345 (I would like to get 12345.00). Moreover, with ROUND() there are no separators, the final result I would like to get is 12,345.00.
@janpeter.van.d, this time I'm not sure if I understand.
My conclusions from your answers above:
- I can't use here, in the formula of the column of the Query data bubble this function formatNumber. Right?
- You suggested the usage of the sum function described here Math functions (celonis.com). Is this something different that I've done already?
Ok, let me see if I understand:
- you have a query component
- in the PQL of that query component, when retrieving the column that was giving you NULL values, now you have a construct like CASE WHEN column IS NULL then 0 else column end
- and now you want to format the output
Â
Ok so far?
Â
If the above is true, now your problem no longer is dealing with the NaN, but just formatting. as you want to show the number i.e. 12345 as 12,345.00
Â
Right?
Â
Well, unfortunately there is no formatting in PQL when converting number to string (only works with dates) (or I can't find it...)
Â
so either you create it by hand with PQL (i.e. use REGEX to split in groups of 3, then concatenate to add the separators, etc....).....
Â
or you use formatNumber() in the ActionFlow (that now should work, as you no longer have NaN values)
Â
Â
Â
HTH
Â
Thank you guys, the solution with separated module in which I modify values which are for sure not NaNs helped.