Ok - difficult to put that in one sentence…
When the DataMapper is extracting fields, I also get a field ‘gender’, telling me, if the addresse is ‘male’, ‘female’ or ‘unknown’.
Depending on the value, I want to add and set 3 additional fields (not already beeing defined): “salutation”, “salutation_short”, “salutation_letter”:
- unknown: “”, “”, “Sehr geehrte Damen und Herren”
- male: “Herr”, “Hr.”, “Sehr geehrter Herr”
- female: “Frau”, “Fr.”, “Sehr geehrte Frau”
I managed this with one extraction step that extracts 3 fields, whereas the value is detemined by a little piece of JavaScript code for every field.
I noticed that I had to write very similar code 3 times - the only difference was the return value according to the value of field “gender”.
I’d prefer to have only one script, that uses a single switch/case-statement to add and set all 3 fields in one step.
How can this be done?
Horrido,
Thomas