Given a decimal number like “123.456” how can I get only the part before the decimal point (in this case “123”) without any rounding etc. being applied?

Assuming your value is already a number in OpenRefine, in GREL I’d use floor in this situation:

`value.floor()`

This gives the greatest integer less than the real number in the value - which would give you “123” in this case (i.e. the portion before the decimal point) - this returns it as a number, which is good if you want to use the output as a number.

The alternative would be to convert the original number to a string first as suggested above, but you need to use a format string to avoid the number being expressed as an exponential. E.g

`value.toString("%f")`

and so the complete expression:

`value.toString("%f").split(".")[0]`

Note that using value.toString(“%f”) does round the number to 6 decimal places by default. If you only want the integer part this isn’t going to matter, but if you wanted to extract the decimal part it would of course. You can specify the number of decimal places to use in the toString command with a period (decimal point) followed by a number of digits. e.g. to round to a whole number (zero decimal places):

`value.toString("%.0f")`

or to round to 10 decimal places:

`value.toString("%.10f")`

etc.

See also the OpenRefine docs for:

toString(): GREL functions | OpenRefine

Math functions including ‘floor’: GREL functions | OpenRefine.