Created
March 10, 2017 21:26
-
-
Save excieve/4b94749652f8503e31422b103e5a6837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun({Doc}) -> | |
{Step0} = proplists:get_value(<<"step_0">>, Doc, {nil}), | |
{Step1} = proplists:get_value(<<"step_1">>, Doc, {nil}), | |
case proplists:get_value(<<"declarationType">>, Step0, nil) of | |
<<"1">> -> | |
Id = proplists:get_value(<<"_id">>, Doc), | |
Lastname = proplists:get_value(<<"lastname">>, Step1), | |
Firstname = proplists:get_value(<<"firstname">>, Step1), | |
Middlename = proplists:get_value(<<"middlename">>, Step1), | |
Result = {[ | |
{<<"FIO">>, <<Lastname/binary, " ", Firstname/binary, " ", Middlename/binary>>}, | |
{<<"workPost">>, proplists:get_value(<<"workPost">>, Step1, nil)} | |
]}, | |
Emit(Id, Result); | |
_ -> nil | |
end | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment