In Output Colums, i would like to round a decimal parameter. Is there any function to do this?
Examples:
user_def_num1= 12.2 → result of function(user_def_num1)=12
user_def_num1= 12.5 → result of function(user_def_num1)=13
user_def_num1= 12.7 → result of function(user_def_num1)=13
…
Globally, is there any list of function we can use?
Thanks
Renaud
Page 1 / 1
Hi @7opRenauN,
You could try adding verification to the field that strips everything after the decimal point. This is a separate area of FSM called regular expressions.
An article on this can be found here:
Or you can change the metadata for this column on the relevant table(s) to be integer instead of decimal which should also prevent the decimal part of the number.
Kind regards,
Lee Pinchbeck
@Lee Pinchbeck Hi,
Thanks for your good ideas!
My parameter is not from an input field but the result of a calcul with a division.
Best regards.
Renaud
Hi @7opRenauN,
Try putting the calculation inside ROUND(). Round() is used in both XML and SQL so should work.
There is not a list of functions but generally it is any function that would directly on the database.
Kind regards,
Lee Pinchbeck
Hi Lee,
Unfortunatly, it’s not working.
In the expression column, I wrote : “ROUND(TASK.USER_DEF_NUM1/8)”
A warning message indicated : The expression ‘ROUND(TASK.USER_DEF_NUM1/8)’ contains unexpected syntax. The exprexpression contains more operands than operators.
Do you have any idea?
Best regards.
Renaud
Hi @7opRenauN,
What is the /8 in the field name? Is this a calculation? If so you will need to put the whole thing in brackets I suspect. The round function will only be able to cope with a number being passed to it not a calculation that needs to be worked out as part of the rounding.
This is not an FSM question that this form is specialist in at this point but a general question on how to write expressions which the general internet is more suited to answering.
Kind regards,
Lee Pinchbeck
Hi @7opRenauN ,
Not quite sure whether the round() function is working as an expression in FSM. Rather than exhausting the user_def fields, if your intension is only to display the rounded value on the screen, you could write a custom sql view with sql “ceiling()” / “round()” function so that you can get the desired value in the expected ceiling format according to your example (would recommend use ceiling() as per your results shown in the question). Make sure to get the task_id and the rounded_values as the result set in your sql view.
Then simply create custom metadata for that view (make the fields as read only) in FSM and you can easily link that view via UI designer with the relationship editor (task.task_id eq custom_view.task_id). Once this is done, drag and drop the custom view filed for the rounded value in to your screen. Refresh your cache and test this.
Hope this would help if your intension is only to display the rounded value.