<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Thomas,</div><div><br></div><div>In this case you should include eldap's hrl file to and use records to pattern match the results.</div><div>Matching records as tuples is considered a bad practice. </div><div><a href="http://www.erlang.se/doc/programming_rules.shtml#HDR23">http://www.erlang.se/doc/programming_rules.shtml#HDR23</a></div><div><br></div><div>I suggest you start with:</div><div><br></div><div> -include_lib("eldap/include/eldap.hrl").</div><div><br></div><div>Note that you'll be dealing with a _list_ of entries. </div><div>lists:map/2 (or list comprehension) can come in handy for further processing.</div><div><br></div><div>Cheers,</div><div>/A.</div><div><br></div><div><br></div><div><div>On Jan 12, 2014, at 9:50 PM, John R. Ashmun <<a href="mailto:john.ashmun@gmail.com">john.ashmun@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>I offer this approach:</div><div><br></div><div>{ok, Result} = eldap:search(S, Search),</div><div>eldap:close(S),</div><div>{eldap_search_result, [{_, _, [{"status", [Status]}]}], []} = Result,</div>
<div><br></div><div>& at this point, Status =:= "available", if I have successfully balanced the brackets and braces.  You may wish also to match 'eldap_entry' in your assignment.</div><div><br></div>
<div>Regards,</div><div>John R. Ashmun<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 12, 2014 at 11:41 AM, Thomas Elsgaard <span dir="ltr"><<a href="mailto:thomas.elsgaard@gmail.com" target="_blank">thomas.elsgaard@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir="ltr"><div>Hi list</div><div> </div><div>I am experimenting with eldap, but i am wondering on how to correctly get the result from an ldap search?</div>
<div> </div><div>In my module, i am doing an eldap:search</div>
<div> </div><div>-----------------</div><div>{ok, Result} = eldap:search(S, Search),</div><div>eldap:close(S),</div><div>io:format("Search Result: ~p~n", [Result]).<br>-----------------</div><div> </div><div>And i am getting following:</div>

<div> </div><div>-----------------</div><div>Search Result: {eldap_search_result,<br>                   [{eldap_entry,<br>                        "blaa,blaaa,blaa,blaa,blaa",<br>                        [{"status",["available"]}]}],<br>

                   []}<br>ok</div><div>-----------------</div><div> </div><div>So far so good, eldap is doing it's work, but what i am really interrested in is just the content of the attribute status which is "available". How can i get the status into an variable? Do i need to get it from an record, or ?</div>
<span class="HOEnZb"><font color="#888888">
<div> </div><div>Thomas </div><div> </div></font></span></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></body></html>