Custom datatype in iReport

Hi

Is there any way use custom dataType in iReport. I create my dataType e.g

@JavaClass(BigDecimal.class)
public class CurrencyDatatype extends BigDecimalDatatype implements Datatype<BigDecimal> {

	private static final String PATTERN = "#,##0.00";
	private static final char GROUPSYMBOLCHAR = '.';

	public CurrencyDatatype(Element element) {
		super(element);
	}

	@Override
	public String format(@Nullable Object value) {
		if (value == null)
			return "";
		DecimalFormat format = new DecimalFormat(PATTERN);
		DecimalFormatSymbols dfs = new DecimalFormatSymbols();
		dfs.setGroupingSeparator(GROUPSYMBOLCHAR);
		format.setDecimalFormatSymbols(dfs);
		return format.format(value);
	}

	@Override
	public String format(@Nullable Object value, Locale locale) {
		return format(value);
	}

	@Override
	public BigDecimal parse(@Nullable String value) throws ParseException {
		if (Strings.isNullOrEmpty(value))
			return BigDecimal.ZERO;

		DecimalFormat format = new DecimalFormat(PATTERN);
		DecimalFormatSymbols dfs = new DecimalFormatSymbols();
		dfs.setGroupingSeparator(GROUPSYMBOLCHAR);
		format.setDecimalFormatSymbols(dfs);
		format.setParseBigDecimal(true);
		BigDecimal result;
		try {
			result = (BigDecimal) format.parse(value);
		} catch (ParseException e) {
			try {
				result = new BigDecimal(value);
			} catch (Exception e1) {
				throw new ParseException("Error parsing " + value, 0);
			}
		}
		return result;
	}

	@Override
	public BigDecimal parse(@Nullable String value, Locale locale) throws ParseException {
		return parse(value);
	}

}

Hello @andrzej.paluch72,

There is no possibility to use a custom data type for reports in JasperReport format. We recommend processing values ​​using groovy in Groovy-dataset.

Regards,
Nikita