Counting records in QField

Is it possible to count records that meet a certain condition in QField by configuring the expression editor in QGIS? I have tried several expressions that work correctly in QGIS, but when I load the project into QField, they have no effect. When adding a new record to QField, it should detect if one of its fields is equal to a specific value and assign a sequential numbering, adding a prefix to distinguish it from the rest, for example:

Layer name = Customers
Field that must contain the comparison value = Continent (Possible values: “America”, “Asia”, “Europe”)
Field that should contain the result = Code (Possible results: “AS01”, “AS02”, “EU01”…)

If I select “Asia” in the Continent field, the Code field should automatically display “AS01” for the first record and “AS02” for the second record. Then, if I select “Europe,” the result should be “EU01,” and so on.

Thank you in advance.


Imported from GitHub discussion by @alexander131290 on 2023-03-30T15:02:13Z