{"action":"created","issue":{"url":"https://api.github.com/repos/sphereio/csv-mapper/issues/4","labels_url":"https://api.github.com/repos/sphereio/csv-mapper/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/sphereio/csv-mapper/issues/4/comments","events_url":"https://api.github.com/repos/sphereio/csv-mapper/issues/4/events","html_url":"https://github.com/sphereio/csv-mapper/issues/4","id":90086622,"number":4,"title":"ValueTransformers type regex replaces if no match is found","user":{"login":"interceptor","id":1118979,"avatar_url":"https://avatars.githubusercontent.com/u/1118979?v=3","gravatar_id":"","url":"https://api.github.com/users/interceptor","html_url":"https://github.com/interceptor","followers_url":"https://api.github.com/users/interceptor/followers","following_url":"https://api.github.com/users/interceptor/following{/other_user}","gists_url":"https://api.github.com/users/interceptor/gists{/gist_id}","starred_url":"https://api.github.com/users/interceptor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interceptor/subscriptions","organizations_url":"https://api.github.com/users/interceptor/orgs","repos_url":"https://api.github.com/users/interceptor/repos","events_url":"https://api.github.com/users/interceptor/events{/privacy}","received_events_url":"https://api.github.com/users/interceptor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-22T12:34:37Z","updated_at":"2015-06-22T16:45:01Z","closed_at":null,"body":"Hello again :)\r\n\r\nI have been busy trying to get the mappings working that I need, an I think I have come across the following Problem:\r\n\r\nI am trying to Replace a Value depending on its content:\r\n\r\n\t\t\t\t\"valueTransformers\": [\r\n\t\t\t\t\t{\"type\": \"print\"},\r\n\t\t\t\t\t{\"type\": \"regexp\", \"find\": \"^(Books)$\", \"replace\": \"55\"},\r\n\t\t\t\t\t{\"type\": \"print\"},\r\n\t\t\t\t\t{\"type\": \"regexp\", \"find\": \"^(Figurines)$\", \"replace\": \"54\"},\r\n\t\t\t\t]\r\n\r\nWhat happends is, that if the Value \"Books\" is not found, \"undefined\" is passed on to the next value transformer... This makes If/else logic implementation impossible.\r\n\r\nAlso, even if only one regex value transformer is defined, it appears that if no match is found, the value \"undefined\" is passed on and you end up with no value (empty string) being written into your target CSV.\r\n\r\nDo I abuse your concept here, or do I missunderstand something?\r\n\r\nGreetings,\r\nMike"},"comment":{"url":"https://api.github.com/repos/sphereio/csv-mapper/issues/comments/114175106","html_url":"https://github.com/sphereio/csv-mapper/issues/4#issuecomment-114175106","issue_url":"https://api.github.com/repos/sphereio/csv-mapper/issues/4","id":114175106,"user":{"login":"interceptor","id":1118979,"avatar_url":"https://avatars.githubusercontent.com/u/1118979?v=3","gravatar_id":"","url":"https://api.github.com/users/interceptor","html_url":"https://github.com/interceptor","followers_url":"https://api.github.com/users/interceptor/followers","following_url":"https://api.github.com/users/interceptor/following{/other_user}","gists_url":"https://api.github.com/users/interceptor/gists{/gist_id}","starred_url":"https://api.github.com/users/interceptor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/interceptor/subscriptions","organizations_url":"https://api.github.com/users/interceptor/orgs","repos_url":"https://api.github.com/users/interceptor/repos","events_url":"https://api.github.com/users/interceptor/events{/privacy}","received_events_url":"https://api.github.com/users/interceptor/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T16:45:01Z","updated_at":"2015-06-22T16:45:01Z","body":"Hi Oleg,\r\n\r\nthank you for your quick response and clarification :) This is what I came up with:\r\n\r\n    {\r\n        \"type\": \"addColumn\",\r\n        \"toCol\": \"Tax rules ID\",\r\n        \"valueTransformers\": [{\r\n\t\t\t{\"Adding Column for Prestashop Tax Rules - ID 55 for CH Super Reduced Rate (2.5%), ID 54 for CH Reduced Rate (3.8%), ID 53 for CH Standard Rate (8.0%)\"},\r\n\t\t\t\"type\": \"multipartString\",\r\n\t\t\t\"parts\": [{\r\n\t\t\t\t\"fromCol\": \"Family\",\r\n\t\t\t\t\"valueTransformers\": [{\r\n\t\t\t\t\t\"type\": \"fallback\",\r\n\t\t\t\t\t{\"type\": \"regexp\", \"find\": \"^(Livres)$\", \"replace\": \"55\"},\r\n\t\t\t\t\t{\"type\": \"regexp\", \"find\": \"^(Figurines)$\", \"replace\": \"54\"},\r\n\t\t\t\t\t{\"type\": \"regexp\", \"find\": \"^(DVD)$\", \"replace\": \"53\"},\r\n\t\t\t\t\t{\"type\": \"required\"}\r\n\t\t\t\t}]\r\n\t\t\t}]\r\n      }]\r\n   \r\nUnfortunately it does'nt do yet what I would like; this currently does not replace the values with the numbers, but the target CSV simply ends up with the strings \"Livres\", \"Figurines\" or \"DVD\"... what am I overlooking?\r\n\r\nGreetings,\r\nMike"}}