<div dir="ltr"><div><div>Hi,<br><br></div><div>I am working on riak database ,<br></div><div><br></div>I am having data in a riak bucket for a key like:<br><br><<"{\"META\": {\"campaign\": \"5IVUPHE42HP1NEYvKb7qSvpX2Cm\",<br>
\"createdat\": 1406978070.0,<br> \"user_email\": \"<a href="mailto:gopikrishnajonnada@gmail.com">gopikrishnajonnada@gmail.com</a>\"},<br> \"mode\": 2,<br> \"status\": \"success\"}">><br>
<br></div><div>I have written a map phase which is giving data like <br><br>[<<"{<<"5IVUPHE42HP1NEYvKb7qSvpX2Cm">>,1}">>, <br> <<"{<<"WL6iHLCgs492rFEFvqewzvCfFfj">>, 2}">>, <br>
<<"{"5IVUPHE42HP1NEYvKb7qSvpX2Cm">>, 1}">>, <br> <<"{<<"5IVUPHE42HP1NEYvKb7qSvpX2Cm">>, 2}">>] <br><br></div><div>so for the above data from mapphase i have to write a reduce phase that should give depending on a condition like if it {key,Vlaue} if value is 0 or 1 then i have to to add new variable like ab_leads and it should increment<br>
<br></div><div>I have tried like this this but the reducefunction should have more number of functions according to [oldlist++newlist]<br><br><a href="http://chat.stackoverflow.com/transcript/message/18089061#18089061" class="" title="click for message actions"><span class=""> </span></a><div class="">
lists:foldl(fun({Key,Mode},Acc)
-> if Mode == 0;Mode == 1 ->
orddict:update_counter({Key,<<"ab_leads">>},1,Acc); true
-> orddict:update_counter({Key,<<"cp_leads">>},1,Acc) end
end,orddict:new(),G).</div> </div><div><br></div><div>[{{Key,{<<"ab_leads">>,10},{<<"cp_leads">>,20}},{Key1,{{<<"ab_leads">>,15},{<<"cp_leads">>,15}}].<br>
<br><br></div><div>please suggest me <br></div><br clear="all"><div><div><div><div><br>-- <br><div dir="ltr"><div><div><div><br></div>Thanks & Regards,<br></div>J.Gopi Krishna<br>+91-8341452934,<br></div><div><a href="http://www.lintelindia.com" target="_blank">www.lintelindia.com</a><br>
</div><div>Lintel Technologies Pvt. LTD,Hyderabad.<br></div><br><font size="1" face="arial, helvetica, sans-serif">This message contains
confidential information and is intended for recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. E-mail transmission cannot be
guaranteed to be secure or error-free as information could be
intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a
result of e-mail transmission. If verification is required please
request a hard-copy version.</font><br></div>
</div></div></div></div></div>