Goal
This document describes the way to return FLOAT fields as TEXT fields with a specific format using the custom function printf.
Content
When dealing with FLOAT fields, it is important to notice that they are truncated following the international configuration for the query executed, the view, the Virtual DataPort database, or the Virtual DataPort server.
If any of these FLOAT fields are required to be returned as a TEXT value, the printf custom function can be used. This custom function is available in the Denodo support site, under the component with the name “Denodo Xtrafuncts for VDP”.
This component contains a jar file with several custom functions that, once imported into Virtual DataPort, can be used as any other function available by default.
The component also contains a documentation file with information about every custom function included. The printf custom function works in the same way as the printf in Java. It allows the following signatures:
- printf (expression, value):
- Performs a String.format (...) formatting operation.
- printf (locale, expression, value):
- Performs a String.format (...) formatting operation. The locale argument is used to get locale-specific formatting of numbers.
For example:
- printf(‘%.4f’, percentage):
- returns a TEXT field for the FLOAT field “percentage” with 4 decimal positions.
Reference:
The information provided in the Denodo Knowledge Base is intended to assist our users in advanced uses of Denodo. Please note that the results from the application of processes and configurations detailed in these documents may vary depending on your specific environment. Use them at your own discretion.
For an official guide of supported features, please refer to the User Manuals. For questions on critical systems or complex environments we recommend you to contact your Denodo Customer Success Manager.

