Custom Function for a new Field (combination of two existing fields)

Custom Function for a new Field (combination of two existing fields)

I have a custom module Eurotax

API Eurotax

 

This module contains 2 fields:

1: EUROTAX, API Name EUROTAX, Data Type Number

2: ROK, API Name ROK, Data Type Pick List

 

I need to add a new field (for example Field3) that will be the combination of the values ​​of the two fields above.

 

Example 1:

Field1: EUROTAX, value 1234

Field2: ROK, value 2024

 

3: The new field:

Field3: value 1234-2024 (Field1 + dash + Field2)

-----------------

Example 2:

Field1: EUROTAX, value 5673456

Field2: ROK, value 2025

 

3: The new field:

Field3: value 5673456-2025 (Field1 + dash + Field2)


 

Could anyone help to write a custom function to received a new field (Field3)?

Should I use workflow rules or something else?