There are several options I may refer you to
- "Field calculator":
qgis:fieldcalculator
Opens the field calculator. You can use all the
supported expressions and functions.
A new layer is created with the result of the expression.
The field calculator is very useful when used in The graphical
modeler.
- "Refactor fields":
qgis:refactorfields
Allows editing the structure of the attribute table of a vector layer.
Fields can be modified in their type and name, using a fields mapping.
The original layer is not modified. A new layer is generated, which
contains a modified attribute table, according to the provided fields
mapping.
Refactor layer fields allows to:
- Change field names and types
- Add and remove fields
- Reorder fields
- Calculate new fields based on expressions
- Load field list from another layer
- Advanced Python field calculator:
qgis:advancedpythonfieldcalculator
Adds a new attribute to a vector layer, with values resulting from
applying an expression to each feature.
The expression is defined as a Python function.
- Execute SQL:
qgis:executesql
Runs a simple or complex query with SQL syntax on the source layer.
Beside a simple query, you can add expressions or variables within the
SQL query parameter itself. This is particulary useful if this
algorithm is executed within a Processing model and you want to use a
model input as a parameter of the query. An example of a query will
then be SELECT * FROM [% @table %]
where @table
is the variable
that identifies the model input.
The result of the query will be added as a new layer.
Answering the question "Expression in the Field Calculator that returns the name of the input layer?"
As was mentioned by @Alexandre Neto:
you can get the layer name using the variable /@layer_name, there is
also the /@layer_id.
Check this article for more details: "Exploring variables in QGIS pt 3: layer level variables".