Hello,
I have a problem with my FME script.
My goal is to create a custom transformer that does the same thing as AttributeValueMapper but by using a dynamic list off matching value.
Why ? Because I have a file witch contain data that I need to clean :
File "data"
field_test_1field_2
field_test_2
xxx
Good morning
ab
xxx
Hello
ac
xxx
Salut
ab
zzz
Bonjour
ab
yyy
Konishiwa
ac
To do this, I have a file which contain all my matching values like this :
File "code_list"
codevalue
CODE_A_01
value xxx
CODE_A_02
value yyy
CODE_A_03
value zzz
CODE_B_01
value ab
CODE_B_02
value ac
CODE_C_01
value xxx
My goal is to replace value in "field_test_1" and "field_test_2" from the file "data" by codes listed in the file "code list".
Little things to keed in mind : codes need to be filtered as values from differents fields can be the same but not corresponding to the same code (has you can see lines 1 and 6 from file "code_list").
First try :
I've used TestFilter + FeatureJoiner + AttributeManager to replace values in my fields : It work as expected but it fill my script with lot's of transformers.
Second try :
I've created a custom transformer to achieve my goal but I have some trouble with it :
Here is published parameters of the transformer :
Here is what you can find inside my transformer :
I get the value of the fields I need, filter codes, perform a join, set the value for the input data field and then removed every field that I didn't need including fields from the "code list" file (with regex).
When I run my script whit one occurence, it works perfectly.
But when I put a second occurence of this custom transformer like this :
Data in "field_test_2" are <missing> and I don't know exactly why.
Bonus : If the tested field contain a space, inside fields aren't removed :
I put the script and the files as attachments if you want to give a try.
Thank you for your help.
Arthur Bazin