Repository navigation
Change Numeric Values to Display 2 decimal Places
Santam Chakraborty edited this page May 14, 2024
·
1 revision
In order to change numeric values calculated from PRO results to display upto 2 decimal places especially in Views Results, you can use twig functions.
To do this:
- Select the individual field in the views.
- Go down to the section titled "Rewrite Results"
- In this check the checkbox titled "Override the output of this field with custom text". This will enable you to overwrite the reuslts.
- Click the replacement patterns link below this to see all the replacement patterns available for this.
- Carefully select the replacement token corresponding to the "raw value" for the field. Please remember this will show all the replacement tokens available for the field so ensure that the correct value is selected.
- Add the following snippet after the replacement token value with a pipe "|"
{{ field_eortc_qlqc30_cf_score__value|number_format(2, '.', ',') }}
In the above example field_eortc_qlqc30_cf_score__value is the raw value of the field_eortc_qlqc30_cf_score field.
See the image below

- Home
- Installation
- Enabling Modules
- Patient Access Configuration Logic
- Multilingual Capability
-
Configuration
- Create Roles
- Super Login Configuration
- Login Logout Redirect Per Role
- Account Setting Configuration
- Email Configuration
- Date Time Format Configuration
- Language Configuration
- Language Detection Configuration
- Entity Access by Role Field Configuration
- Permission Configuration
- Administer Users By Role Configuration
- Enabled Modules
- Pathauto Configuration
- Redirect Configuration
- Questionnaire Configuration
- Howtos