What's the batched Refactor Fields tool "field mapping" syntax in QGIS?

It is not very comfortable to do, but the following is the required syntax for that textbox (I write it in several lines only for the sake of clearness):

{'expression': u'type the expression here',
 'length': <type the length>,
 'type': <code of the type>,
 'name': u'type the field name here',
 'precision': <type the precision>}

For example (remeber to use curly brackets):

{'expression': u'"FLAG1"+"FLAG2"',
 'length': 20, 'type': 6,
 'name': u'FLAG1',
 'precision': 5}

You need to write as many lines like the one above as the number of input fields, separated by commas. For example, if your layer contains three fields:

{'expression': u'"FLAG1"+"FLAG2"', 'length': 20, 'type': 6, 'name': u'FLAG1', 'precision': 5}, {'expression': u'100*"FLAG2"', 'length': 20, 'type': 6, 'name': u'FLAG2', 'precision': 5}, {'expression': u'"100-"FLAG2"', 'length': 20, 'type': 6, 'name': u'FLAG3', 'precision': 5}

and it should work (it worked for me).

Please note that you may avoid to use this dictionary-oriented syntax and directly use the required values. For example, with reference to the first example, you may simply use:

{u'"FLAG1"+"FLAG2"', 20, 6, u'FLAG1', 5}

If you don't use this syntax, the following error will be shown:

Missing parameter value: Fields mapping (row 1)


There is another algorithm similar to this whose interface simplifies the batch process better.

enter image description here