Specify @Currency annotation at run time

Is it possible to change this annotation in execution time ?, to be able to change the currency shown depending on a parameter?

1 Like

Hi!

Are you talking about changing a value of the @Currency annotation that is used for some entity field? If I’m right, you can take a look at good examples here: link.

But I suggest that it is more simple to use the CurrencyField component (documentation) and its method setCurrency(String currency) if it is suitable for you.

Best regards,
Daniil.

This is what I’m looking for, but I have a question about its use. Is it possible to use it within a FieldGroup? since I’ve noticed that FieldGroup makes use of the @Currency annotation

Yes, the FieldGroup component will create the CurrencyField component for the fields that are annotated with the CurrencyValue annotation.

There were a couple of regressions related to the FieldGroup and CurrencyField and if you will meet problems - don’t worry, we’ll release bug fix soon.

Best regards,
Daniil.