GitHub user dosubot[bot] added a comment to the discussion: How to add a new 
currency

<!-- Greeting -->
Hi @DanielViniAssis! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.

<!-- Answer -->
To add a new currency in the latest versions of Apache Superset (3.0.0+), you 
need to update the list of supported currencies in the codebase. Superset uses 
an enumeration called CurrencyCode in the NumericCell component to define which 
currencies are available. To add your currency, edit the file at 
`superset-frontend/src/components/Table/cell-renderers/NumericCell/index.tsx` 
and add your currency code to the `CurrencyCode` enum. For example, to add the 
"ABC" currency:

```ts
export enum CurrencyCode {
  ...
  ABC = 'ABC',
  ...
}
```
You may also want to ensure your new currency is supported in any relevant 
formatting utilities or control panels, as recent versions have added currency 
controls and support for more charts. These changes are documented in the 
[changelog for 
3.0.0](https://github.com/apache/superset/blob/master/CHANGELOG/3.0.0.md) and 
related files. Superset now allows you to specify currency formatting in 
control panels for supported charts, so after updating the enum, your new 
currency should appear as an option where currencies are selectable.

If you need to persist currency information with metrics, note that a migration 
script has added a `currency` column to the `metrics` and `sql_metrics` tables, 
which may be relevant if you are customizing metric storage or display logic 
[source](https://github.com/apache/superset/blob/master/superset/migrations/versions/2023-06-21_14-02_90139bf715e4_add_currency_column_to_metrics.py).

If you have trouble seeing your new currency in the UI after making these 
changes, make sure to rebuild the frontend assets.

Issue #3972 is quite old and refers to previous approaches; the current method 
is to update the `CurrencyCode` enum and leverage the new currency controls in 
the UI as described above.


<!-- Dosu Comment Footer -->
*To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=hallucination)
 | [Report 
šŸ›](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/e86bf449-a448-4c9c-b30c-af5186367cbb?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Sh
 are on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/33608)

GitHub link: 
https://github.com/apache/superset/discussions/33608#discussioncomment-13300137

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to