You mention Set Field, but then don't use it in your examples.
I think you want:
Set Field [tableName::FieldName ; TableName::FieldName + 1]
When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [TableName::FieldName ; Expression], add set field to your script and click the first button (specify target field). Select TableName::FieldName from the list of fields. Click OK. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.
I only wrote out the things I filled in after the specify buttons.
The normal set field function won't help me here since i don't 'know' the name of the field. i want to extract this name from a field containing a string and then let the 'set field by name'-function find this field and change the value of this field to the prior value + 1.
Sorry, missed the "by name" detail.
I think this is what you need if TableName::fieldstoringNameofField stores the table and field names of the field to be incremented.
Set field by Name [ tableName::fieldstoringnameOfField ; getField ( TableName::FieldStoringNameofField ) + 1 ]
Check out both set field by Name and Get Field in FileMaker help to make sure that the above syntax works for you. Some functions that indirectly reference a field require or return a table name and a field name others, just the field name.
In some applications of this technique you can pass the name of the relevant field with GetFieldName ( Table::Field ) passed as a parameter to the script. This trick enables you to refer to the table and field name in a way that will update automatically if you later change the name of the field or table.
Thank you so much! Have been spending quite some time on this:P
My main mistake was that m fieldstoringnameOfFiel did not contain the table.